<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat = "server">
<title></title>
<script type = "text/javascript">
function ToggleValidator() {
var rb = document.getElementById("<%=RadioButtonList1.ClientID %>");
var valName = document.getElementById("<%=RequiredFieldValidator1.ClientID%>");
if (rb.getElementsByTagName("input")[0].checked) {
ValidatorEnable(valName, false);
}
else {
ValidatorEnable(valName, true);
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:RadioButtonList ID="RadioButtonList1" runat="server" onclick = "ToggleValidator()">
<asp:ListItem Text = "Yes" Value = "Yes"></asp:ListItem>
<asp:ListItem Text = "No" Value = "No" Selected = "True"></asp:ListItem>
</asp:RadioButtonList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Required" ControlToValidate = "TextBox1">
</asp:RequiredFieldValidator>
<br />
<asp:Button ID="Button1" runat="server" Text="Submit" />
</form>
</body>
</html>