Validating Radio Button List using Required Filed Validator

Neeks
Posted by Neeks under ASP.NET category on | Views : 32361
<form id="form1" runat="server">
<div>
<%--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>
</asp:RadioButtonList>
<%--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>
</form>

Comments or Responses

Login to post response