Click here to Skip to main content
15,895,830 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to assign a value in dropdownlist based on selection

Feedback design page as follows

To What extent equipment is uptodate Dropdownlist1(Excellent/good/Fair)
To what extent equipment is user friendly Dropdownlist2(Excellent/good/Fair)
To What extent were the practicals Realistic Dropdownlist2(Excellent/good/Fair)

for example in Dropdownlist1 if user select the Excellent means 1 value to be store in the database.
similarily, in Dropdownlist2 if user select the good means 2 value to be store in the database.
similarily, in Dropdownlist3 if user select the Fair means 3 value to be store in the database.

for that how can i do in asp.net using c#.

regards,
narasiman P.
Posted
Comments
Karthik_Mahalingam 29-Jan-14 7:31am    
Homework ?

if the datatype in sql table is int, or whatever... then u have to convert it into.. int

i'm used this code:

int userID = convert.toint32(ddluser.selectvalue);

n if u want to select the saved item of dropdownlist then

this code:

ddluser.items.findbyvalue(dr["user"].tostring()).selected = true;



Hope this may help u.
 
Share this answer
 
you can try and set value field of dropdown list via code or even you can set value from list item value property in design view only.

in code you can use

dropdownlist.selectedvalue to submit the value in the database.
 
Share this answer
 
set 'value' to each of your dropdownlist items and use Dropdownlist1.SelectedValue
 
Share this answer
 

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