Good Afternoon Developer,
this is my content in asp .net, I want the user can check only 2 checkbox,exceeding that alert box should pop up.
<body>
<form id="form1" runat="server">
<div>
<table width="100%">
<tr>
<td>
<asp:CheckBox id="q3a" runat="server" Text="Public" />
</td>
<td>
<asp:CheckBox id="q3b" runat="server" Text="void" />
</td>
<td>
<asp:CheckBox id="q3c" runat="server" Text="protected"/>
</td>
<td>
<asp:CheckBox id="q3d" runat="server" Text="return" />
</td>
</tr>
</table>
<asp:Button ID="btnSubmit" Text="submit" runat="server"/>
</div>
</form>
</body>
how can i write javascript for this, i have tried but can’t find any way out, Pls help…
You should stop the user the instant they try and select a third option so that only two checked values can ever be submitted and avoid server side validation.
The client side onchange event should be hooked up to a function similar to this;
The input should render with
onchange="validationCheck(this);".