467,143 Members | 1,185 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,143 developers. It's quick & easy.

Need Mechanism or code for wait state in asp.net web application

SP
Hi,
I want to add wait cursor code whenever page is post back. Page may be
post back on my user control's or on change of dropdown or on click of any
button on page. so is there any common solution available that will provide
me mechanism to display wait cursor or wait image to user whenever page is
post back to server?

Thanks,
--
Nov 18 '05 #1
  • viewed: 2169
Share:
6 Replies
put a script on body on event onbeforeunload="ChangeCursorStatus();"

javascript:
function ChangeCursorStatus(){
document.body.style.cursor = "wait";
}

it's very unpleasant this solution because you have to put in every page,
but it works. I couldn't find any other solution to put this code dinamically
on body :(.

Cheers

"SP" wrote:
Hi,
I want to add wait cursor code whenever page is post back. Page may be
post back on my user control's or on change of dropdown or on click of any
button on page. so is there any common solution available that will provide
me mechanism to display wait cursor or wait image to user whenever page is
post back to server?

Thanks,
--

Nov 18 '05 #2
SP
Thanks Psycho,

I tried that solution but it will solve my half problem, actually i want
to display user a cursor and also put application in wait state that user
can not perform another action till one action is performed. means if user
click on my save button then till save action is performed and page is load
till that user can not perform any other action means he will restrict till
one action performed.

I have one solution of threading. means put application in thread and wait
that thread for some second and till that display some image after
completing this i show form to user. but it will give error when i redirect
page to another page that data can not send because of http header is
already written.

If you will know any other solution than please tell me.

Thanks once again,


"Psycho" <Ps****@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
put a script on body on event onbeforeunload="ChangeCursorStatus();"

javascript:
function ChangeCursorStatus(){
document.body.style.cursor = "wait";
}

it's very unpleasant this solution because you have to put in every page,
but it works. I couldn't find any other solution to put this code dinamically on body :(.

Cheers

"SP" wrote:
Hi,
I want to add wait cursor code whenever page is post back. Page may be post back on my user control's or on change of dropdown or on click of any button on page. so is there any common solution available that will provide me mechanism to display wait cursor or wait image to user whenever page is post back to server?

Thanks,
--

Nov 18 '05 #3
you should try to make all of your controls disabled. i use a javascript also
for this task. So on event onbeforeunload put another javascript to disable
controls or make a function which is doing your both tasks.

some function like this
function DisableControls(){
nr = document.forms[0].all.length;
for(i=0;i<nr;i++){
if(document.forms[0].all(i).tagName == "SELECT" ||
(document.forms[0].all(i).tagName == "INPUT" &&
(document.forms[0].all(i).type == "radio" || document.forms[0].all(i).type ==
"checkbox" || document.forms[0].all(i).type == "button") ))
document.forms[0].all(i).disabled = true;
}
}

Cheers

"SP" wrote:
Thanks Psycho,

I tried that solution but it will solve my half problem, actually i want
to display user a cursor and also put application in wait state that user
can not perform another action till one action is performed. means if user
click on my save button then till save action is performed and page is load
till that user can not perform any other action means he will restrict till
one action performed.

I have one solution of threading. means put application in thread and wait
that thread for some second and till that display some image after
completing this i show form to user. but it will give error when i redirect
page to another page that data can not send because of http header is
already written.

If you will know any other solution than please tell me.

Thanks once again,


"Psycho" <Ps****@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
put a script on body on event onbeforeunload="ChangeCursorStatus();"

javascript:
function ChangeCursorStatus(){
document.body.style.cursor = "wait";
}

it's very unpleasant this solution because you have to put in every page,
but it works. I couldn't find any other solution to put this code

dinamically
on body :(.

Cheers

"SP" wrote:
Hi,
I want to add wait cursor code whenever page is post back. Page may be post back on my user control's or on change of dropdown or on click of any button on page. so is there any common solution available that will provide me mechanism to display wait cursor or wait image to user whenever page is post back to server?

Thanks,
--


Nov 18 '05 #4
Hi SP:

You don't want to go anywhere near the threading classes for this one,
trust me. You need to perform actions on the client, and the least
intrusive way to do this is with client side script.

Psycho: If you create a base class to derive all your web forms from,
you can put a call to RegisterClientScript in one place and have the
script appear in all of your web forms. There are a few articles
around describing how inherit from the Page class to add useful
features. Here is one:

http://msdn.microsoft.com/library/de...rockASPNET.asp

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 27 Oct 2004 17:41:15 +0530, "SP" <SP@Microsoft.com> wrote:
Thanks Psycho,

I tried that solution but it will solve my half problem, actually i want
to display user a cursor and also put application in wait state that user
can not perform another action till one action is performed. means if user
click on my save button then till save action is performed and page is load
till that user can not perform any other action means he will restrict till
one action performed.

I have one solution of threading. means put application in thread and wait
that thread for some second and till that display some image after
completing this i show form to user. but it will give error when i redirect
page to another page that data can not send because of http header is
already written.

If you will know any other solution than please tell me.

Thanks once again,


"Psycho" <Ps****@discussions.microsoft.com> wrote in message
news:18**********************************@microso ft.com...
put a script on body on event onbeforeunload="ChangeCursorStatus();"

javascript:
function ChangeCursorStatus(){
document.body.style.cursor = "wait";
}

it's very unpleasant this solution because you have to put in every page,
but it works. I couldn't find any other solution to put this code

dinamically
on body :(.

Cheers

"SP" wrote:
> Hi,
> I want to add wait cursor code whenever page is post back. Page maybe > post back on my user control's or on change of dropdown or on click ofany > button on page. so is there any common solution available that willprovide > me mechanism to display wait cursor or wait image to user whenever pageis > post back to server?
>
> Thanks,
>
>
> --
>
>
>


Nov 18 '05 #5
Thanks for advice Scott but i'm already using a customPage and also the
method RegisterStartupScript. My problem is with body. I can't attach any
event dinamically. I don't want to go to every page to put on body
runat="server" and id="body" just to add from behinde code, javascript on
body events. So I prefer to add on body events. Is any other way to do this?
"Scott Allen" wrote:
Hi SP:

You don't want to go anywhere near the threading classes for this one,
trust me. You need to perform actions on the client, and the least
intrusive way to do this is with client side script.

Psycho: If you create a base class to derive all your web forms from,
you can put a call to RegisterClientScript in one place and have the
script appear in all of your web forms. There are a few articles
around describing how inherit from the Page class to add useful
features. Here is one:

http://msdn.microsoft.com/library/de...rockASPNET.asp

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 27 Oct 2004 17:41:15 +0530, "SP" <SP@Microsoft.com> wrote:
Thanks Psycho,

I tried that solution but it will solve my half problem, actually i want
to display user a cursor and also put application in wait state that user
can not perform another action till one action is performed. means if user
click on my save button then till save action is performed and page is load
till that user can not perform any other action means he will restrict till
one action performed.

I have one solution of threading. means put application in thread and wait
that thread for some second and till that display some image after
completing this i show form to user. but it will give error when i redirect
page to another page that data can not send because of http header is
already written.

If you will know any other solution than please tell me.

Thanks once again,


"Psycho" <Ps****@discussions.microsoft.com> wrote in message
news:18**********************************@microso ft.com...
put a script on body on event onbeforeunload="ChangeCursorStatus();"

javascript:
function ChangeCursorStatus(){
document.body.style.cursor = "wait";
}

it's very unpleasant this solution because you have to put in every page,
but it works. I couldn't find any other solution to put this code

dinamically
on body :(.

Cheers

"SP" wrote:

> Hi,
> I want to add wait cursor code whenever page is post back. Page may

be
> post back on my user control's or on change of dropdown or on click of

any
> button on page. so is there any common solution available that will

provide
> me mechanism to display wait cursor or wait image to user whenever page

is
> post back to server?
>
> Thanks,
>
>
> --
>
>
>


Nov 18 '05 #6
Ah, apologies - I didn't really think about the body tag needing to be
runat=server (and honestly, JavaScript is a real weak area for me).
--
Scott
http://www.OdeToCode.com/blogs/scott/

On Wed, 27 Oct 2004 07:59:10 -0700, Psycho
<Ps****@discussions.microsoft.com> wrote:
Thanks for advice Scott but i'm already using a customPage and also the
method RegisterStartupScript. My problem is with body. I can't attach any
event dinamically. I don't want to go to every page to put on body
runat="server" and id="body" just to add from behinde code, javascript on
body events. So I prefer to add on body events. Is any other way to do this?


Nov 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Paramveer.Singh@trilogy.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.