Hi all
I'm trying to call a JavaScript function through my CodeBehind page of my .aspx WebForm. I have added the following code in the Page_Init event:
btnDelete.Attributes.Add ("onclick", "return CheckDeletion(this.form);"
and btnDelete is a WebForms button control.
The code for the onclick is a direct cut and paste of the code that appeared for the onclick event of a standard input button control.
When I try to run it, it first gives me the error:
Expected '('
No matter if I click Yes/No to debug, the rest of the page loads fine ...
When I click my Delete button, it gives me the following error:
Microsoft JScript runtime error: Object expected
and it's breaking on the following line of code: onclick="return CheckDeletion(this.form);"
I've tried passing the actual form name, but it still gives me the exact same error.
If I make the button a normal <input> control, and put the code behind the onclick event, it runs fine :-(
Any ideas on this please?
Thanks as always
Craftor
I'm trying to call a JavaScript function through my CodeBehind page of my .aspx WebForm. I have added the following code in the Page_Init event:
btnDelete.Attributes.Add ("onclick", "return CheckDeletion(this.form);"
and btnDelete is a WebForms button control.
The code for the onclick is a direct cut and paste of the code that appeared for the onclick event of a standard input button control.
When I try to run it, it first gives me the error:
Expected '('
No matter if I click Yes/No to debug, the rest of the page loads fine ...
When I click my Delete button, it gives me the following error:
Microsoft JScript runtime error: Object expected
and it's breaking on the following line of code: onclick="return CheckDeletion(this.form);"
I've tried passing the actual form name, but it still gives me the exact same error.
If I make the button a normal <input> control, and put the code behind the onclick event, it runs fine :-(
Any ideas on this please?
Thanks as always
Craftor