我发现GridView 动态生成时,RadioBox 的name 都不一样。不能实现只选中其中一个

解决方案 »

  1.   

    <asp:RadioButton ID="rd_type1" Text="一级类别" runat="server" GroupName="type" Checked="True" AutoPostBack="True" />
    <asp:RadioButton ID="rd_type2" Text="二级类别" runat="server" GroupName="type" Width="82px" AutoPostBack="True" />
      

  2.   

    你添加模板列如下:
                                <asp:TemplateField>
                                    <ItemTemplate>
                                     <input name="MyRadioButton" type="radio"
                                      value='<%# Eval("ProjectID") %>+|+<%# Eval("ProjectName") %>' />
                                    </ItemTemplate>
                                </asp:TemplateField>使用<input name="MyRadioButton" type="radio" 就可以了
    string selectedValue = Request.Form["MyRadioButton"];可以得到你选中那一行的value
      

  3.   

    即使你把GroupName设成一样的,也照样能多选,我当初就遇到过这个问题。
      

  4.   

    GroupName 相同就可以了
      

  5.   

      即使你把GroupName设成一样的,也照样能多选,我当初就遇到过这个问题。
      我碰到的一样。不知道怎么样解决!!!!
      

  6.   

    for(int i=0;i<GV.Rows.Count;i++)
    {
       
    }
    然后判断,如果某一列被选中(取出ID),则其他各列将处于非选中状态,应该能实现
      

  7.   

    设置模板列中radioButton的GroupName为同一字串即可,这样同一组的单选钮只能选中一个
      

  8.   

    正确的方法是在DataItemBind事件中控制RadioButton的选中不选中的,仅仅靠GroupName是不行的。
      

  9.   

    当显示数据有上万条时,
    for(int   i=0;i <GV.Rows.Count;i++) 

          
    } 效率很底!!!
    还是没满意答案啊!!!!!!!