Gridview containing dependent dropdownlist errors on selected index changed

control parameter , , gridview , dropdownlist United States
  • 7 years ago

    I have a dropdownlist2 in a gridview whose datasource and select control parameter is based on the selected value of dropdownlist1 in the same gridview. Everything works great for insert, but when I edit the row in the gridview and change the selected value in dropdownlist1, I get an error of "'dropdownlist2' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value" This kinda makes sense to me. At what stage (maybe drowdownlist1 selectedindexchanged?) do I tell dropdownlist2 that it needs to requery so I don't get the error. I can just tell it to select the 0 index by default here for dropdownlist2. An example would be lovely.

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).


Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“A computer lets you make more mistakes faster than any other invention in human history, with the possible exceptions of handguns and tequila” - Mitch Ratcliffe