Li said:
Hi,
I appreciate if someone provide sample codes of how to add radio buttons
into a datagrid.
Use this script to create RadioButtons. When a RadioButton is clicked,
OnCheckedChanged event will be fired. Write a server-side code to catch
this event.
<asp
ataGrid id="dgOrnek" runat="server"
AutoGenerateColumns="False">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:RadioButton AutoPostBack=True
OnCheckedChanged="DetayGoster"
id="rbsira" Text='deneme' runat="server"/>
<ItemTemplate>
<TemplateColumn>
<Columns>
........
Dim sRbText as String = ""
Public Sub DetayGoster(sender as object, e as eventargs)
Dim rb as New RadioButton
rb= (RadioButton) sender
sRbText = rb.ClientId
Dim item
For each item in dgOrnek.Items
rb = (RadioButton) i.FindControl("rbsira")
rb.Checked = false
if sRbText=rb.ClientID then
rb.Checked = true
txtSiraNo.Text = rb.Text.Trim()
// if you want to get a property of the selected id
end if
Next
End Sub
In VB.NET you have to find out how to translate
rb= (RadioButton) sender (taken from c#)
i think you should try as
rb = sender
Best of luck