本文介绍了在页面加载时显示值并在radiobuttonlist中选择的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





i有一个radiobuttonlist

我将所选项目存储在数据库中。



但是我想要在编辑页面中选择该项目



当我clcikon编辑个人资料然后那个时候在radiobutton列表中选择的值





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

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

推荐答案

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



这篇关于在页面加载时显示值并在radiobuttonlist中选择的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-12 07:23