I was wondering if a command like "SqlDataSource1 .insert()" can somehow give me the new index that was created when the insert took place. If the insert always occurs at the end of the dataset then I assume something like "...Count" could be used to figure out where the insert is going to take place. I am not sure if there is a "Count" in SqlDataSource. Unfortunately, I didnt see a callback for something like "ItemInsert ed" which would give me the index. I did set some breakpoints and poke around to find an index but gave up.
SqlDataSource.I nsert() just returns the number of rows inserted which is just 1 unless something goes wrong.
Anyway, what I want to do is to set DetailView1.Pag eIndex to that new index number so I can then use the DetailView display to help create a new record in my GridView.
This whole exercise is caused by the lack of a "new row" in gridview. Does dotnet 3.5 or the new ajax have any mechanism for a gridview "new row"?
I am using this as a guide to handleing the "new row" problem in my gridview. The scheme works fine if there is no paging. If there is pageing you have to hunt for where the new empty row is. I thought I would switch to a DetailView the instant "new" was selected and set the index page of the DetailView to the "new index" Since DetailView1 has an update and cancel button then I can use that to add my new row into the gridview.
Maybe someone can suggest a better way to add a new row. I have several grids and wanted to come up with a common scheme to handle all of them. Previously I hand coded forms for each new grid row.
I am also trying to avoid using stored procedures though I know it is possible to have the new index returned. Just was hoping to do all this in code
thanks for looking