I hope this will be the final solution, if somebody has a small project and this solution didn't work with him I hope that he send me his small project so I make sure that he didn't miss any point.
There are two columns involved:
- The one that you retrieve the values from. Let’s call it "Status".
- The one that you insert values to. Let’s call it "process_type".
Suppose you have 3 values in the first column "Status": [New,In progress,Canceled]. In the GridVew or any data control you are showing the second column "process_type", and you want it to be shown as a DropDownList when you click "Edit", then you
have to
open the second column "process_type" from the database and make sure that there is no cell has a value which does not exist in the first column "Status", even Null are not accepted in the second column unless you have null values in the first column.
There is one small thing left you might not notice if you have added a WHERE clause, when you make your SELECT statement for the second column "process_type", and you have added a WHERE clause, you have to make sure that all the values that will be retrieved
from this SELECT statements match all the values that will be retrieved from the first column "Status".
Advice: I think it's obvious now that you have to make the right user interface in such a way to force the user to enter the values that match with the vales from the first column. usually you will be using a dropdownlist.
Muhammad way
Member
22 Points
54 Posts
Re: 'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of...
Aug 09, 2009 05:07 AM|LINK
I hope this will be the final solution, if somebody has a small project and this solution didn't work with him I hope that he send me his small project so I make sure that he didn't miss any point.
There are two columns involved:
- The one that you retrieve the values from. Let’s call it "Status".
- The one that you insert values to. Let’s call it "process_type".
Suppose you have 3 values in the first column "Status": [New,In progress,Canceled]. In the GridVew or any data control you are showing the second column "process_type", and you want it to be shown as a DropDownList when you click "Edit", then you have to
open the second column "process_type" from the database and make sure that there is no cell has a value which does not exist in the first column "Status", even Null are not accepted in the second column unless you have null values in the first column.
There is one small thing left you might not notice if you have added a WHERE clause, when you make your SELECT statement for the second column "process_type", and you have added a WHERE clause, you have to make sure that all the values that will be retrieved from this SELECT statements match all the values that will be retrieved from the first column "Status".
Advice: I think it's obvious now that you have to make the right user interface in such a way to force the user to enter the values that match with the vales from the first column. usually you will be using a dropdownlist.