Reputation: 11
I am trying to call the JavaScript "DisableAllPopUpTxt()" from the page behind with following code:
ScriptManager.RegisterStartupScript(GetType(), "Javascript", "javascript:DisableAllPopUpTxt();", true);
But it is giving me following error:
No overload of method RegisterStartupScript takes 4 aurguments Please tell me where I'm wrong.
Actually my MasterPage has one modal dialog registration form which has client side validations. Because of validations I'm not able to do any post back.
So I'm trying to disable all text boxes using the JS function "DisableAllPopUpTxt()" on page load.
function DisableAllPopUpTxt() {
document.getElementById("txtCustEmailID").disabled = true;
document.getElementById("txtCustPwd").disabled = true;
document.getElementById("txtCustFName").disabled = true;
document.getElementById("txtCustLName").disabled = true;
document.getElementById("txtCustREmail").disabled = true;
document.getElementById("txtCustRPwd").disabled = true;
document.getElementById("txtCustRePwd").disabled = true;
document.getElementById("txtCustPh").disabled = true;
}
But I'm not able to call it on page load.
How to solve this problem?
Upvotes: 1
Views: 5554
Reputation: 461
Please try these changes also as you are using master page.
function DisableAllPopUpTxt() {
document.getElementById("<%=txtCustEmailID.ClientID%>").disabled = true;
document.getElementById("<%=txtCustPwd.ClientID%>").disabled = true;
document.getElementById("<%=txtCustFName.ClientID%>").disabled = true;
document.getElementById("<%=txtCustLName.ClientID%>").disabled = true;
document.getElementById("<%=txtCustREmail.ClientID%>").disabled = true;
document.getElementById("<%=txtCustRPwd.ClientID%>").disabled = true;
document.getElementById("<%=txtCustRePwd.ClientID%>").disabled = true;
document.getElementById("<%=txtCustPh.ClientID%>").disabled = true;
}
Upvotes: 0
Reputation: 9074
It takes 5 parametrs and you have passed 4 and in wrong way.
It should be:
ScriptManager.RegisterStartupScript(this,this.GetType(), "Javascript", "javascript:DisableAllPopUpTxt();", true);
Syntax :
ScriptManager.RegisterStartupScript Method (Control, Type, String, String, Boolean);
Can follow example over here.
Upvotes: 3