You can also verify that a value should be selected in radio button list before processing. The sample code is given below, Please let me know in case of any erros while implementation.
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<body>
<form id="Form1" runat="server">
<h4>
Check for atleast one Radio button selection</h4>
<br />
Select a option:
<asp:RadioButtonList ID="rdo_Websites" RepeatLayout="Flow" runat="server">
<asp:ListItem>SoftwareTestingNet.com</asp:ListItem>
<asp:ListItem>IndiHub.com</asp:ListItem>
<asp:ListItem>BharatClick.com</asp:ListItem>
</asp:RadioButtonList>
<br />
<asp:Button ID="Button1" Text="Submit" runat="server" />
<br />
<br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="rdo_Websites"
Text="Please select a option" runat="server" />
</form>
</body>
</html>
No comments:
Post a Comment