Validating RadioButtonList Selection through Validation Controls
-
Hi, I want to validate radioButtonlist, say I want one of them to be selected before saving it. I placed a custom validator and OnServervalidate, I invoked a function to validate it. But somehow it seems that its not working, Can someone provide me guidelines as how to do it through asp.net validation controls or provide some code? Thanks
-
Hi, I want to validate radioButtonlist, say I want one of them to be selected before saving it. I placed a custom validator and OnServervalidate, I invoked a function to validate it. But somehow it seems that its not working, Can someone provide me guidelines as how to do it through asp.net validation controls or provide some code? Thanks
Hi there, In this case, you simply use a RequiredFieldValidator to validate the RadioButtonList, and remember to set the id of the radiobuttonlist in the ControlToValidate property of the validator. You also need to make sure that each item of the radiobuttonlist has its value. Another way is to always select an item by default, then you don't need any validator here to validate the control.