Sunday, 18 December 2011

How to make single Selection of Radio Button in a Grid View using

Some time its happens in a Gridview have a column with more radio buttons but it do not select a single selection of a radio button. It selects all the radio buttons as you select it. For get Rid from this Problem. Given Below function can help you:

Protected Sub RdAdd_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs)
        Dim dr As GridViewRow
        Dim oldRow As RadioButton = GdvAdd.FindControl("rdadd")
        Dim count = 0
        'TextBox3667.Text = Request.Form("RDI")
        For Each dr In GdvAdd.Rows
            oldRow = CType(GdvAdd.Rows(count).FindControl("rdadd"), RadioButton)
            oldRow.Checked = False
            count += 1
        'ADD Old Value
        Dim NewRow As RadioButton = sender
        Dim row As GridViewRow = NewRow.NamingContainer
        NewRow.Checked = True
    End Sub

No comments:

Post a Comment