Reputation: 907
I Have A grid view with 3 radio buttons. How Can I Know Which Radio Button Is Selected>
Code:
Upvotes: 0
Views: 3021
Reputation: 22323
Try this.
foreach (GridViewRow row in gridview.Rows)
{
RadioButton rbn=new RadioButton();
rbn=(RadioButton)row.findcontrol("YourRadiobuttonId");
if(rbn.Checked)
{
//Try your condition what u want
}
}
Upvotes: 1
Reputation: 3821
Please give a try
foreach (GridViewRow row in gridview.Rows)
{
RadioButton radioBtn=new RadioButton();
radioBtn=(RadioButton)row.findcontrol("YourRadiobuttonId");
if(radioBtn.Checked)
{
// Your appropriate code here
}
}
Upvotes: 2