Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,

i have an error on dropdownlist
when i run the page of edit_profile_page
then that time it loads successfully and then that time data also completly filled successfully..
but when i changed the dropdownlist value and click on updatebutton it shows error.

SQL
'cmbprofilefor' has a SelectedValue which is invalid because it does not exist in the list of items.
Parameter name: value


"cmbprofilefor" is my dropdownlist name

i used this line of code for selected item which is stored in database

C#
cmbprofilefor.SelectedValue = dt.Rows[0]["ProfileFor"].ToString().Trim();


this code is successfully work and display value selected in dropdownlist which stored in database.
but when i change the items means when i selected item changed from dropdownlist) and click on save button that time it shows me error.

where is the my mistake ??
Posted

1 solution

The error should be clear. You are trying to set a value to be something that does not exist in the datasource for the drop down. You'll need to debug it to find out why that is.
 
Share this answer
 
Comments
Manish Dalwadi 2-Mar-14 3:18am    
okay its done...
error solved...
thanks dr.
ZurdoDev 2-Mar-14 20:22pm    
Good to hear it.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900