I’ve got the answer if I were using SqlDataSource by Overriding the Insert Statement and use the @@IDENTITY property, but when I use the LinqDataSource, I couldn’t override the Insert statement!
so, the problem is:
I’m using ASP.NET Webform, DetailsViewControl in Insert Mode and LinqDataSource.
I want to retrieve the new ID of the inserted record. What’s the easiest and the most efficient way to do that?
Thanks.
Using LinqDataSource.Inserted Event
Example from MSDN shows that newProduct.ProductID is the new ID.