Hi,
This is another problem I just solved. I found all possible stuff on the internet and no one had solved it in an easier fashion. Though people might call it JUGAD Tech but I must say what I have made just worked for me.
The problem with using radio buttons in a gridview is that even if u use the groupname property of the radio button it will select multiple radio buttons.
So what i did is
1. To the column tag of the gridview add the following code
protected void uncheckOthers(object sender, EventArgs e)
{
int count = GridView1.Rows.Count;
for (int i = 0; i < count; i++)
{
RadioButton rb = (RadioButton)GridView1.Rows[i].Cells[0].FindControl("selectItem");
rb.Checked = false;
}
RadioButton test=(RadioButton)sender;
test.Checked = true;
}
Isn't it easy..
Cheers!!!
Vaibhav
Sunday, July 20, 2008
RadioButtons in gridview. Select one at a time
Posted by vaibhav at 5:14 PM
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment