yes, see the example below.
<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" errormessage="Select One option"></asp:RequiredFieldValidator>
Either you can use initialvalue property required filed validator. which is like
<asp:RequiredFieldValidator
runat="server" ID="radRfv"
ControlToValidate="radio"
initialvalue="0" errormessage="Select one option"></asp:RequiredFieldValidator>
No comments:
Post a Comment