Friday 20 May 2011

Loading a Drop down List in Row Created

If you need to populate a drop down list in a Grid View row created event you may find that the items in the list are appearing twice.

I found this problem is caused if you call databind on the drop down list from within the Row Created event of the grid view. It looks as though the drop down list is automatically calling DataBind when the gridview calls the Row Databound event.

Removing the call to databind from the row created event fixed the issue.

eg:

No comments:

Post a Comment