I have a page that has a input checkbox that will execute JavaScript code to show/hide a div. My requirements just changed to do server side code as well as show/hide the div. Is it possible to make a checkbox do both client JavaScript and server side code?
Checkbox:
<input type="checkbox" id="chkTemp" />
This is the javascript that runs when the checkbox is checked or unchecked.
$('#chkTemp').click(function () {
if ($('#chkTemp').is(":checked")) {
$("#<%=(hdnTemp.ClientID)%>").val('true');
$('#divTemp').show();
}
else {
$('#divTemp').hide();
$("#<%=(hdnTemp.ClientID)%>").val('false');
}
});
Since I need to do server side code I added
<asp:CheckBox ID="chkTemp2" runat="server" AutoPostBack="True" OnCheckedChanged="chkTemp2_CheckedChanged" />
Is it possible to have chkTemp2 execute javascript on the client and server side code at the same time?
Aucun commentaire:
Enregistrer un commentaire