Data Grid Events

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!
 
W

Wilco Bauwer

Try adding a check whether the request is a postback or not. You should
avoid rebinding the data on each postback.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top