Tuesday, March 30, 2010

Radio button in Data grid with Single selection

//Posted By Suresh

add radio buttons to datagrid:


OnCheckedChanged="SelectOnlyOne"
id="RadioButton1" Text='hi' runat="server"/>





public void SelectOnlyOne(object sender,EventArgs e)
{
RadioButton rb = new RadioButton();
rb = (RadioButton) sender;
string sRbText = rb.ClientID;

foreach (DataGridItem i in DDLCon.Items)
{
rb = (RadioButton) i.FindControl ("RadioButton1");
rb.Checked = false;
if (sRbText==rb.ClientID)
{
rb.Checked = true;
}
}
}

No comments:

Post a Comment