<asp:DataGrid id='DataGrid1' AutoGenerateColumns='False' runat='server'>
<Columns>
<asp:TemplateColumn HeaderText='FirstName'>
<ItemTemplate>
<input type='radio' name='optSelectedName'
value=<%#DataBinder.Eval(Container.DataItem, 'FirstName') %>
onclick='javascript:txtFname.value = this.value;'><%#DataBinder.Eval(Container.DataItem, 'FirstName') %>
<br>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
<asp:Button id='Button1' style='Z-INDEX: 101; LEFT: 154px; POSITION: absolute; TOP: 103px' runat='server'
Text='Button'></asp:Button>
<div style='VISIBILITY: hidden'>
<asp:TextBox ID='txtFname' Runat='server' />
</div>
VB.NET
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
’Bind the Datagrid with dataSet
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Response.Write('You have selected :' & txtFname.Text)
End Sub
C#
private void Page_Load(object sender, System.EventArgs e)
{
//Bind the datagrid to dataset
}
private void Button1_Click(object sender, System.EventArgs e)
{
Response.Write('You have selected :' + txtFname.Text);
}
Share with