RadioButton?

解决方案 »

  1.   

    选择编辑列  添加一个ItemTemplate列   在里面加一个RadioButton就可以了
      

  2.   

    通过JS来实现 给你个源码吧,绝对可以//前台
    <asp:GridView ID="gv" runat="server" OnRowDataBound="gv_RowBound">
       <Columns>
          <asp:TemplateField HeaderText="客户确认">
             <ItemTemplate>
               <asp:RadioButton ID="RB_Confim" runat="server" GroupName="name" />
             </ItemTemplate>
            <ItemStyle HorizontalAlign="center" Width="90px" />
            <HeaderStyle HorizontalAlign="Center" Font-Bold="false" Width="90px" />
          </asp:TemplateField>
        </Columns>
    </asp:GridView>
    //js
    function onClientClick(selectedId)
       {
            var inputs = document.getElementById("gv").getElementsByTagName("input");//如果你用木板页的话getElementById("gv")就应换成getElementById("<%=gv.ClientID%>"),客户端ID了。
            for(var i=0; i <inputs.length; i++)
            {
                if(inputs[i].type=="radio")
                {
                    if(inputs[i].id==selectedId)
                        inputs[i].checked = true;
                    else
                        inputs[i].checked = false;
                   
                }
            }
       }
    //后台
    protected void gv_RowBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                RadioButton rb = (RadioButton)e.Row.FindControl("RB_Confim");
                if (rb != null)
                    rb.Attributes.Add("onclick", "onClientClick('" + rb.ClientID + "')");
            }    }
      

  3.   

    我试过了,添加后,每一行的RadioButton都可以选上,都不是单选了。好像分开了。