0

I have GridView and one columns is a RadioButton for select. How can I set a validator for columns to check that at least one RadioButton is selected?

Kelsey
  • 47,246
  • 16
  • 124
  • 162

2 Answers2

1

I posted to a similar question the other day with a solution that should work for you:

How to check that at least one RadioButtonList has an item selected?

It uses a CustomValidator with a server side check to ensure at least one item is selected. You will need to substitute looking for a RadioButton instead of the RadioButtonList and maybe a few other tweeks but the code should work for what you need. It searchs for all of one type of control and checks for a specific critera. In your case look for all RadioButton controls and ensure at least one is checked.

Community
  • 1
  • 1
Kelsey
  • 47,246
  • 16
  • 124
  • 162
0

there is no out-of-the-box way for what you are asking, you will need to use custom validator and implement the logic yourself on the client as well as on the server side; few way you can go about it, the one that comes to mind is to have the custom validator logic check at least one of the checkboxes is checked for passing IsValid, we will need more details about your structure to provide more specific solution

Kris Ivanov
  • 10,476
  • 1
  • 24
  • 35
  • @K Ivanov : there is nothing special in my structure. a TemplateField that contain a asp radio button or a html radio button. and a button that search for a checked radoibutton in server side. –  Mar 03 '11 at 10:42