Hi,
Can any one help me with this datagrid template column issue?
Any code example will be greatly appreciated.
I am developing an application in ASP.net. (Language
Vb.net)
Requirement is to display a radio button column within a data grid.
To get this working so far I have placed a template column with HTML radio button control in the data grid.
(I am using a HTMLINPUT radio button control in the template column, as radio button web control does not work within a grid)
Below is the code for rendering radio button dynamically and group it. The grouping and rendering works fine.
Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
If e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.Item Then
Dim lblOpt As label
lblOpt = e.Item.FindControl("lblOption")
lblOpt.Text = "<input type=radio name='"& e.Item.Cells(1).Text &"' value=" & e.Item.Cells(2).Text & ">"
End If
End Sub
I am looking for solution of the following:
1) On post back - based upon radio button selection, I want to update the underlying dataset that binds to the data grid.
2) I want to retain radio button selection on data grid paging.
Thank you all in advance.
Regards,
-Satyajit