Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
nallyaRank #8,588 · 219 reputationPosted Sep 20, 2012, 9:44 PM EDT
To use the RequiredFieldValidator for radion button in ASP.NET you must use the RadioButtonList control. It is not possible to do it with the normal radion button.
nallyaRank #8,588 · 219 reputationPosted Sep 17, 2012, 11:13 PM EDT
1. First add the RadioButtonList control to your page.
2. Now add the RequireFieldValidator to your page. Make sure you set the ControlToValidate property to the ID of the RadioButtonList.
3. Set all the other proporties of the two control as required.
EXAMPLES:
<tr>
<td>
Would you like to continue?
<br />
td>
<td class="style1">
<asp:RadioButtonList ID="rdlYesNo" runat="server" RepeatDirection="Horizontal">
<asp:ListItem Text="Yes" Value="Yes">asp:ListItem>
<asp:ListItem Text="No" Value="No">asp:ListItem>
asp:RadioButtonList>
<asp:RequiredFieldValidator ID="rfvrdlYesNo" runat="server" ControlToValidate="rdlYesNo"
Display="Dynamic" ErrorMessage="Would you like to continue? is required."
ValidationGroup="InflightProfile">*asp:RequiredFieldValidator>
td>
tr>
<tr>Gopi Shankar25 reputationPosted Sep 20, 2012, 9:34 PM EDT
Sukesh MarlaRank #461 · 5.4K reputationPosted Sep 20, 2012, 10:52 PM EDT
Check my article on Validation control
http://www.c-sharpcorner.com/UploadFile/SukeshMarla/Asp-Net-validation-control/
let me know if have any confusion