Link to home
Start Free TrialLog in
Avatar of Si_Hibbard
Si_HibbardFlag for United States of America

asked on

Gridview - populating dropdownlist in codebehind

hi Guys,
I am having a nightmare with this, i really hate using gridviews.
Anyway, basically i have a dropdown list in a gridview, which i want to bind to a datasource and populate it from codebehind (this allows me to populate it from a file listing).

I have tried to populate the list in just about all the gridview events, rowupdating, databound etc but as soon as i hit edit in the gridview i get an error stating the selectedvalue does not exist - thats because it is trying to set the selectedvalue (needed to bind it) before i can populate it.

So summary:

I click on the gridview edit button, which event do i use to populate the dropdown - without getting the
"SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value"



god this should be so simple.
Avatar of Raju Srivatsavaye
Raju Srivatsavaye
Flag of United States of America image

if your gridview has a autogenerated edit button then bind it in the row_editing event of the datagrid
ASKER CERTIFIED SOLUTION
Avatar of Si_Hibbard
Si_Hibbard
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator