Hi
I want by default Radio Button should be ticked. I am using below code but it is not worling. If i Uncheck nithing happens
<asp:Repeater ID="rptData" runat="server" OnItemDataBound="rptParticipant_ItemDataBound"> <ItemTemplate> <tr> <td> <asp:Literal ID="ltrlNum" Text="<%# Convert.ToString(Container.ItemIndex + 1) %>" runat="server"></asp:Literal></td> <td > <asp:Literal ID="ltrlNomineeName" runat="server" Text='<%# Eval("Name") %>'></asp:Literal> </td> <td > <asp:Literal ID="ltrlDesignation" runat="server" Text='<%# Eval("Designation") %>'></asp:Literal> </td> <td > <asp:Literal ID="ltrlPhoneNo" runat="server" Text='<%# Eval("PhoneNo") %>'></asp:Literal> </td> <td > <asp:Literal ID="ltrlEmail" runat="server" Text='<%# Eval("Email") %>'></asp:Literal> </td> <td class="text-center"> <div class="btn-group btn-group-toggle" data-toggle="buttons"> <asp:RadioButton ID="rb1" runat="server" class="form-check-input-styled" AutoPostBack="true" OnCheckedChanged="rbtnSelectEmp_OnCheckedChanged" /> </div> </td> </tr> </ItemTemplate> </asp:Repeater>
protected void rbtnSelectEmp_OnCheckedChanged(object sender, EventArgs e) { foreach (RepeaterItem item in rptData.Items) { RadioButton rbtn = (RadioButton)item.FindControl("rb1"); rbtn.Checked = false; } ((RadioButton)sender).Checked = true; }
Thanks