<asp:CheckBox ID="htmlChkNotify" runat="server" OnCheckedChanged="ToggleTextBox(this,'htmlTxtNotifyemailaddress')" />
<asp:TextBox ID="htmlTxtNotifyemailaddress" runat="server" Enabled="false"></asp:TextBox>
function ToggleTextBox(CheckBox, TextBoxID) {
var TextBox = document.getElementById(TextBoxID);
if (CheckBox.checked) {
TextBox.disabled = false;
TextBox.value = "";
}
else {
TextBox.disabled = true;
TextBox.value = "";
}
}
I have write like but when I run the code then error message comeing ” can’t be pass this literal” something like that, so how can I do it?
Actually u can also see demo in stackoverflow “Notify daily of any new answers” I want to fire event like.
Thank you
OnCheckChangedis expecting an ASP.Net event handler, it’s not for JavaScript, for that attach your event handler like this:I broke it down to 2 lines for readability here only, but the idea is to generate an
onclickinline handler, rather than the server-side event handler it’s currently trying to bind, in a place it can’t passthis(which is why the parser fails).