473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

prevent multiple clicks Master page

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
Apr 28 '06 #1
5 3212
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.

"André" wrote:
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

Apr 28 '06 #2
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:Butto n1','');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
"clickon" wrote:
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.

"André" wrote:
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

Apr 28 '06 #3
You should disable the submit button clientside on the first click

"André" <An**@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
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:Butto n1','');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
"clickon" wrote:
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.

"André" wrote:
> 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

Apr 28 '06 #4
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
"Jeff Dillon" wrote:
You should disable the submit button clientside on the first click

"André" <An**@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
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:Butto n1','');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
"clickon" wrote:
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.

"André" wrote:

> 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


Apr 28 '06 #5
anyone have any ideas?

"André" wrote:
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
"Jeff Dillon" wrote:
You should disable the submit button clientside on the first click

"André" <An**@discussions.microsoft.com> wrote in message
news:EB**********************************@microsof t.com...
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:Butto n1','');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
"clickon" wrote:

> 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.
>
> "André" wrote:
>
> > 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


May 3 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: NotGiven | last post by:
Say you have three pages, a search page, a results/master, and a detail page. You choose parameters on your search page and submit the page. The results show in the reults/master page. You...
1
by: Job Lot | last post by:
How can I prevent multiple instances of MdiChild form? I have a MdiParent form with a DataGrid showing all the clients in the database. User clicks on a row to open MdiChild form which display...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
4
by: EagleRed | last post by:
I am writing an ASP.NET 2.0 application that uses more than one master page. Currently, there are two pages, Freedom1.master and Freedom2.master. I have no problems with Freedom1.master. However,...
1
by: lushgrass | last post by:
this is a .net 2003 c# windows form project. there is a menu button called "search" it does a lot of stuff and takes some time. i need to prevent the form from allowing the user to click on it...
3
by: Rich | last post by:
Hi, I want to use 2 master pages, one for the main part of the site, the other for the admin pages. They are quite similar, with many shared elements. Ideally I would like to have a parent...
4
by: Greg | last post by:
I have a complex page (with 8 complex user controls, and many other asp.net controls.) I have 2 very similiar pages to create, each page differing only from the others in one control. What is...
3
by: MikeB | last post by:
Hello, I have a content page that is from a Master page which has 2 content panes. How do I add my forms to the content page? Each pane needs a form but you can not have multiple form tags nor...
0
by: helveticus | last post by:
I have a master/details configuration that includes multiple user controls. The details page is configured to cache data via VaryByCustom. This works fine. One of the user controls contains an...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.