Data Grid Events

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When the user presses the "Edit" link on the data grid, one of the fields is
a drop down list. I need to build this list at run time and I was using the
"DataBound" envent to populate the items in the dropdown.

The problem is that when the user makes a selection from the dropdown box,
it goes back through the DataBound event and rebuild the drop down,
effectively loosing the value for the selected index. I have tried the
"ItemCreated" event, but the same thing happens.

How do you load a drop down control for a control which is in the "EditItem"
Template, but still retain the selected index value when the user has pressed
the "Update" linked button when in the "edit mode" of the datagrid.

Thansk in advance for your assistance!
 
Try adding a check whether the request is a postback or not. You should
avoid rebinding the data on each postback.
 
You have to have a post back to get into edit mode...so checking for
postback will ensure that I do not load the items into my control....

So this will not work.
 
Back
Top