Master/detail table import issue

I have a master table, call main, with id, name. And detail table called d, with id, id_main,name. Id_main is foreign key to table main.

I click an entry from main table, come up to detail table. I want to use import to import record. The detail table id, id_mail,name, id is automatically generated .
in the Row_inserting, renew[“id_mail”]=? I do I get the id from master table?

You can use the Row_Import server event to get the foreign key.