Validating Radio Button List using Required Filed Validator

Posted by Neeks under ASP.NET category on | Views : 34337
<form id="form1" runat="server">
<%--Creating RadioButtonList Control in ASPX Page--%>
<asp:RadioButtonList runat="server" ID="radio">
<%--Creaint Items to be display in Radio Button List--%>
<asp:ListItem Value="0">Male</asp:ListItem>
<asp:ListItem Value="1">Female</asp:ListItem>
<%--Creating RequiredFieldValidator control to validate RadioButtonList that we have created--%>
<asp:RequiredFieldValidator runat="server" ID="radRfv" ControlToValidate="radio">*</asp:RequiredFieldValidator>
<%--Creating a Button to Submit the Page--%>
<asp:Button ID="Button1" runat="server" Text="Button" /></div>

Comments or Responses

Login to post response