从数据库里读出数据一个是“否”,一个是“是”
把这两个数据赋值给radiobuttonlist, 
 <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal"
                                    Width="60px">
                                    <asp:ListItem Selected="True">否</asp:ListItem>
                                    <asp:ListItem>是</asp:ListItem>
                                </asp:RadioButtonList></td>
数据库里的数据是“否”的时候,"RadioButtonList1的选择是“否”,else 是“是”的选项
            if (t.ToString() == "是")
                {
                   ?
                 }
                else
                {
                  ?                }

解决方案 »

  1.   

    RadioButtonList.SelectedValue=t.ToString();
      

  2.   

    控件名写错了,应该是:RadioButtonList1.SelectedValue=t.ToString();
      

  3.   


      foreach (ListItem li in this.RadioButtonList1.Items)
                {
                    if (li.Text == "是")
                    {
                        li.Selected = true;
                    }
                }
      

  4.   

    RadioButtonList1.SelectedValue=t.ToString()==是的时候;?这句不行,还是选“否”,
      

  5.   

    ListItem x = RadioButtonList1.Items.FindByText("是");
    if(x != null) x.Selected=true;
    ListItem xx = RadioButtonList1.Items.FindByText("否");
    if(xx != null) xx.Selected=true;
      

  6.   


    <asp:RadioButtonList ID="RadioButtonList1" runat="server">
        <asp:ListItem Selected="True">否</asp:ListItem>
        <asp:ListItem>是</asp:ListItem>
        </asp:RadioButtonList>
    protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                RadioButtonList1.SelectedValue = "是";
            }
        }
      

  7.   

    数据库一般存"1"和"0"
    ListItem item={Text:"是",Value:"1"};
    ListItem item2={Text:"否",Value:"0"};
    绑到RadioButtonList控件
    RadioButtonList1.SelectedValue="1"或"0"
      

  8.   

    <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal"
      Width="60px">
      <asp:ListItem Selected="True" Value="否">否</asp:ListItem>
      <asp:ListItem Value="是">是</asp:ListItem>
      </asp:RadioButtonList></td>
    给每个项加上Value并等于对应的Text
      

  9.   

    你数据库中是 是 否 还是 1,0
    如果是 1,0 就判断一下
    string value=t==1?"否":"是";
    RadioButtonList1.SelectedValue=value;
    t 是你从数据库中获取的值
    如果是汉字 就直接赋值!
      

  10.   

    <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal"
      Width="60px">
      <asp:ListItem Selected="True">否</asp:ListItem>
      <asp:ListItem>是</asp:ListItem>
      </asp:RadioButtonList>  if (!IsPostBack)
            {
                //t 是 数据库中取到的值!
                int t = 0;
                string a = t == 1 ? "否" : "是";
                RadioButtonList1.SelectedValue = a.ToString();
            }经过测试可以实现
      

  11.   

     RadioButtonList1.SelectedValue = ds.Tables[0].Rows[0]["st"].ToString();奇怪我这个值ds.Tables[0].Rows[0]["st"].ToString()赋值给 RadioButtonList1.SelectedValue没用,显示不了,我数据库里的数据是“是”,但是RadioButtonList1显示的都是“否”,
     <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal"
      Width="60px">
      <asp:ListItem Selected="True">否</asp:ListItem>
      <asp:ListItem>是</asp:ListItem>
      </asp:RadioButtonList></td>
    不知道是什么原因?
      

  12.   

    是不是跟  <asp:ListItem Selected="True">否</asp:ListItem有关?
      

  13.   

    我数据库里的数据是“是”,进入编辑页面的时候, RadioButtonList1显示的是“否”,可能是赋值不成功?数据读取出来是对的,我测试过的