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?

- 47,246
- 16
- 124
- 162
2 Answers
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.
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

- 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