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

i have a radiobuttonlist
and i stored selected items in database.

but i want to that item selected in edit page

when i clcikon edit profile then that time that value selected in radiobutton list

SQL
radiobuttonlist ==> rdophysicalstatus1
radiobutton list's items are :=

Doesn't Matter , Normal , Physically Challenged

if  "normal" stored in database then how to retrive it in radiobuttonlist and keep selected
Posted

Try this:

C#
SqlCommand cmd = new SqlCommand("Select column from tablename", con);
     SqlDataReader dr = cmd.ExecuteReader();
     dr.Read();
     string value = dr[0].ToString();
     dr.Close();
     if (value == "Doesn't Matter")
     {
         rdophysicalstatus1.SelectedIndex = 0;

     }
     Else if (value == "Normal")
      {
         rdophysicalstatus1.SelectedIndex = 1;

     }
     //and so on
 
Share this answer
 
v2
Comments
Manish Dalwadi 1-Mar-14 13:52pm    
thanx dr.

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