Hi,
you can check this once for your requirement.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script language ="javascript" >
function changeval() {
if (document.getElementById("chb1").checked) {
RequiredFieldValidator1.validationGroup = "g1";
}
else {
RequiredFieldValidator1.validationGroup = "";
}
if (document.getElementById("Chb2").checked) {
RequiredFieldValidator2.validationGroup = "g1";
}
else {
RequiredFieldValidator2.validationGroup = "";
}
if (document.getElementById("Chb3").checked) {
RequiredFieldValidator3.validationGroup = "g1";
} else {
RequiredFieldValidator3.validationGroup = "";
}
if (document.getElementById("Chb4").checked) {
RequiredFieldValidator4.validationGroup = "g1";
} else {
RequiredFieldValidator4.validationGroup = "";
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown"></asp:textbox>
<asp:requiredfieldvalidator id="RequiredFieldValidator1" controltovalidate="TextBox1" validationgroup="g1" runat="server" errormessage="RequiredFieldValidator" xmlns:asp="#unknown"></asp:requiredfieldvalidator><br />
<asp:textbox id="TextBox2" runat="server" xmlns:asp="#unknown"></asp:textbox>
<asp:requiredfieldvalidator id="RequiredFieldValidator2" controltovalidate="TextBox2" validationgroup="g1" runat="server" errormessage="RequiredFieldValidator" xmlns:asp="#unknown"></asp:requiredfieldvalidator><br />
<asp:textbox id="TextBox3" runat="server" xmlns:asp="#unknown"></asp:textbox>
<asp:requiredfieldvalidator id="RequiredFieldValidator3" controltovalidate="TextBox3" validationgroup="g1" runat="server" errormessage="RequiredFieldValidator" xmlns:asp="#unknown"></asp:requiredfieldvalidator><br />
<asp:textbox id="TextBox4" runat="server" xmlns:asp="#unknown"></asp:textbox>
<asp:requiredfieldvalidator id="RequiredFieldValidator4" controltovalidate="TextBox4" validationgroup="g1" runat="server" errormessage="RequiredFieldValidator" xmlns:asp="#unknown"></asp:requiredfieldvalidator><br />
<asp:button id="Button1" runat="server" text="Button" validationgroup="g1" xmlns:asp="#unknown" /><br />
<input type ="checkbox" id="chb1" value ="TextBox1" />TextBox1<br />
<input type ="checkbox" id="Chb2" value ="TextBox2" />TextBox2<br />
<input type ="checkbox" id="Chb3" value ="TextBox3" />TextBox3<br />
<input type ="checkbox" id="Chb4" value ="TextBox4" />TextBox4<br />
<input type ="button" id="btnchange" value="Set Validation" onclick="changeval()" />
</div>
</form>
</body>
</html>
In the above page run it as it is then
check checkbox which textbox to validate then click set validate.
after that click Button you'll see validation for textboxes which you selected
All the Best