GridView With Radio Button

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gyanendar
    New Member
    • Jun 2007
    • 90

    GridView With Radio Button

    Hi All ,
    I want to have radio button inside the Gridview ,for selecting a row .
    When I am using
    <asp:TemplateFi eld>
    <ItemTemplate >
    <asp:RadioButto n ID="rb" runat ="server" GroupName ="G2" />
    </ItemTemplate>
    </asp:TemplateFie ld>
    Code ,all the radio button are becoming selectable.

    Please suggest me how to do this.

    Regards,
    Gyanendar
  • gyanendar
    New Member
    • Jun 2007
    • 90

    #2
    I got the solution..in
    http://www.gridviewguy .com/ArticleDetails. aspx?articleID= 149

    Comment

    • shweta123
      Recognized Expert Contributor
      • Nov 2006
      • 692

      #3
      Hi,


      You should make the Checked property of the radiobutton False if you want it to be unselected.
      e.g.
      Code:
      <asp:RadioButton ID="rb" runat ="server" GroupName ="G2" Checked="false" />
      Another point is , you do not have to specify the Group Name property if there is only one radio button in the group.



      Originally posted by gyanendar
      Hi All ,
      I want to have radio button inside the Gridview ,for selecting a row .
      When I am using
      <asp:TemplateFi eld>
      <ItemTemplate >
      <asp:RadioButto n ID="rb" runat ="server" GroupName ="G2" />
      </ItemTemplate>
      </asp:TemplateFie ld>
      Code ,all the radio button are becoming selectable.

      Please suggest me how to do this.

      Regards,
      Gyanendar

      Comment

      • gyanendar
        New Member
        • Jun 2007
        • 90

        #4
        Originally posted by shweta123
        Hi,


        You should make the Checked property of the radiobutton False if you want it to be unselected.
        e.g.
        Code:
        <asp:RadioButton ID="rb" runat ="server" GroupName ="G2" Checked="false" />
        Another point is , you do not have to specify the Group Name property if there is only one radio button in the group.
        The main problem with this code is It doesn't serve the main pupose of radiobutton(i.e . more than one radio button checked at a time.) when used in gridview.

        Regards,
        Gyanendar

        Comment

        Working...