GridView 嵌套单选按钮<asp:TemplateField HeaderText="状态">
   <ItemStyle Width="100px" />
   <ItemTemplate>
       <asp:RadioButton ID="rbt_y" runat="server" Text="显示" GroupName="b" />
       <asp:RadioButton ID="rbt_n" runat="server" Text="隐藏" GroupName="b" />
    </ItemTemplate>
</asp:TemplateField>如何根据表字段设置单选按钮的状态

解决方案 »

  1.   

    rbt_y.Checked true是点选 false是未点选
      

  2.   

    没看明白什么意思?
    是访问GRIDVIEW 里面的控件吗?
      

  3.   

           (RadioButton)GridView1.FindControl("RadioButton1") .Checked =true;
    是这个意思吗?
      

  4.   

    数据库表中有一字段 IsHide 0 显示 , 1隐藏
    读取这一字段后,根据值来设置GridView模板列的两个单选按钮的状态.
      

  5.   

    先用一列绑定列中的值,然后在GRIDVIEW的绑定事件中解决
      

  6.   

    <asp:RadioButton ID="rbt_y" runat="server" Text="显示" GroupName="b" Checked='<%# Convert.ToBoolean("datafield")%>' />
    <asp:RadioButton ID="rbt_n" runat="server" Text="隐藏" GroupName="b" Checked='<%# Convert.ToBoolean("datafield")%>' />
      

  7.   

    <asp:TemplateField HeaderText="状态"> 
      <ItemStyle Width="100px" /> 
      <ItemTemplate>
          <input id="isShow" type="text" runat="sever" style="display:none" value='<%# DataBinder.Eval(Container.DataItem, "你的列")%>'>
          <asp:RadioButton ID="rbt_y" runat="server" Text="显示" GroupName="b" /> 
          <asp:RadioButton ID="rbt_n" runat="server" Text="隐藏" GroupName="b" /> 
        </ItemTemplate> 
    </asp:TemplateField> 数据绑定事件string strShow = ((TextBox)e.Row.FindControl("isShow")).value;
    if(strShow == "1")
        rbt_y.checked = checked;
    ................
      

  8.   

    在GridView 的RowUpdating事件中如何获取单选按钮状态