I'm using EntityDataSource with DetailsView in my ASP.NET application. I want to get identity column value after inserting the record. ObjectDataSource has e.ReturnValue property I want to know its equivalent in EntityDataSource?
Asked
Active
Viewed 566 times
1 Answers
1
You can subscribe to the Inserted
event, which is an EventHandler<EntityDataSourceChangedEventArgs>
.
The EntityDataSourceChangedEventArgs
instance has an Entity property, representing the newly inserted entity.
void EntityDataSource1_Inserted(object sender, EntityDataSourceChangedEventArgs e) {
YourEntityType newlyAdded = (YourEntityType)e.Entity;
int newId = newlyAdded.Id;
}

Adam Rackis
- 82,527
- 56
- 270
- 393
-
Thank for the reply. Can you please have a look at my another question? http://stackoverflow.com/questions/8603383/use-stored-procedure-in-entitydatasource – hotcoder Dec 23 '11 at 07:24