prevent multiple clicks Master page

G

Guest

Hi,

I am using this code to prevent multi click asp.net 2.0 c#,

System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("SetValue();");
sb.Append("if (typeof(Page_ClientValidate) == 'function') { ");
sb.Append("if (Page_ClientValidate() == false) { return false;
}} ");
sb.Append("this.value = 'Please wait...';");
sb.Append("this.disabled = true;");
sb.Append(this.Page.GetPostBackEventReference(this.btnSubmit));
sb.Append(";");

this.btnSubmit.Attributes.Add("onclick", sb.ToString());

When I add this code to a page using a masterpage i get an error, "Objected
Expected"

I tried changing "this.disable" to btnSubmit.ClientID + ".disable" but
nothing works.

Thanks

Andre
 
G

Guest

Where is the btnSubmit control child or master page, is it inseide any other
controls;

Where is the code, Child or master page, what event handler is it in or
called from.
 
G

Guest

on the Child,

this is the html :

<input type="submit" name="_ctl0:ContentPlaceHolder1:Button1" value="Button"
onclick="SetValue();if (typeof(Page_ClientValidate) == 'function') { if
(Page_ClientValidate() == false) { return false; }} this.value = 'Please
wait...';this.disabled =
true;__doPostBack('_ctl0:ContentPlaceHolder1:Button1','');WebForm_DoPostBackWithOptions(new
WebForm_PostBackOptions("_ctl0:ContentPlaceHolder1:Button1", "", true, "",
"", false, false))" language="javascript"
id="_ctl0_ContentPlaceHolder1_Button1" />


all the code is on the child, and i've tried page load, page int, page int
comp, all of them are giving me the same error.

I have this code on the preload event

// Button1.Attributes.Add("onclick", "document.aspnetForm." +
Button1.ClientID + ".value = 'Please wait.'");

this works but this isn't what I need.

Thanks

Andre
 
G

Guest

I have reg expression validators on there, if it fails to validate, then the
button is locked.

The code I have below works if it's not on a master page. I want/need to
understand why it's not working more so then anything else.

Thanks

Andre
 
G

Guest

anyone have any ideas?

André said:
I have reg expression validators on there, if it fails to validate, then the
button is locked.

The code I have below works if it's not on a master page. I want/need to
understand why it's not working more so then anything else.

Thanks

Andre
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top