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
Code
" runat="server">
'>
'>
'>
'>C#
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

Abhishek ChadhaRank #402 · 6.2K reputationPosted Sep 21, 2022, 1:56 PM EDT
either you use below property
or
From the code behind, you can write it as on page load event
if (!IsPostBack) { rb1.Checked = true; }