Radio button check and on check

Hi Experts,

I have a radio button in side my gridview control.
<asp:radiobutton ID="RBShowManu" runat="server"  AutoPostBack="true" >asp:radiobutton>

When I click the radio button it checked it. When I click the next radio button it checked the other one too. What can I do to check only one radio button at a time. I am using ASP.NET and VB.NET

Thank you
RadhaKrishnaKiJayaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CamilliaCommented:
You need a "groupname"

Like this
<asp:radiobutton ID="RBShowManu" runat="server" GroupName="showmenu"  AutoPostBack="true" >asp:radiobutton>

<asp:radiobutton ID="SecondRBShowManu" runat="server" GroupName="showmenu"  AutoPostBack="true" >asp:radiobutton>
0
RadhaKrishnaKiJayaAuthor Commented:
Thank you for your reply. I changed it but still it is selecting all the radio buttons when I click. I want to select only one radio button which I click.
0
CamilliaCommented:
Post your code
0
RadhaKrishnaKiJayaAuthor Commented:
Thank you for trying to help me. But its working now. I used the following code.

 Protected Sub GridView_RadioButton_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)

        deselect_RB_in_gridview()
        Dim SenderRB As RadioButton = sender
        'SenderRB.Checked = True
        Dim gvr As GridViewRow = SenderRB.NamingContainer
        Dim rb As RadioButton = CType(GVViewParts.Rows(gvr.RowIndex).FindControl("RBShowManu"), RadioButton)
        rb.Checked = True
end sub


Sub deselect_RB_in_gridview()
        Dim gvr As GridViewRow
        Dim i As Int32
        'deselect all radiobutton in gridview
        For Each gvr In GVViewParts.Rows
            Dim rb As RadioButton
            rb = CType(GVViewParts.Rows(i).FindControl("RBShowManu"), RadioButton)
            rb.Checked = False
            i += 1
        Next
    End Sub
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
RadhaKrishnaKiJayaAuthor Commented:
I found the solution. Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.