Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Loading/splash screen / RegisterOnSubmitStatement

Reply
Thread Tools

Loading/splash screen / RegisterOnSubmitStatement

 
 
Brian Christensen
Guest
Posts: n/a
 
      08-22-2006
Hi,
Due to long periods during postbacks I'm experimenting on having a load
screen. Best practice for this I have been unable to find so I hope
someone here can point me in the right direction. I use the ASP 2.0
framework.

I want it to be a generel thing and hence I've played around with
ClientScript.RegisterOnSubmitStatement(...)
that injects js into the asp.framwork function

function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() ==
false) return false;
return true}

An example of using this:
function WebForm_OnSubmit() {
page.loadingMessage.show();
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() ==
false) return false;
return true;
}

This will cause clientside validation to be fired AFTER I show my
loading screen and hence the system "locks" if a clientside validator
is triggered

The next - to me - logical step would be to inject the following code
via RegisterOnSubmitStatement
if (typeof(ValidatorOnSubmit) == ""function"" && ValidatorOnSubmit() !=
false) { page.loadingMessage.show(); }

which produces

function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() !=
false) { page.loadingMessage.show(); };if (typeof(ValidatorOnSubmit) ==
"function" && ValidatorOnSubmit() == false) return false;
return true;
}

Homefree? Not yet as this will cause the clientside validator to fail
and just go straight to postback instead.

Any pointers are greatly appreciated.

Brian

 
Reply With Quote
 
 
 
 
Brian Christensen
Guest
Posts: n/a
 
      08-29-2006
<bump> anyone?

Brian Christensen wrote:
> Hi,
> Due to long periods during postbacks I'm experimenting on having a load
> screen. Best practice for this I have been unable to find so I hope
> someone here can point me in the right direction. I use the ASP 2.0
> framework.
>
> I want it to be a generel thing and hence I've played around with
> ClientScript.RegisterOnSubmitStatement(...)
> that injects js into the asp.framwork function
>
> function WebForm_OnSubmit() {
> if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() ==
> false) return false;
> return true}
>
> An example of using this:
> function WebForm_OnSubmit() {
> page.loadingMessage.show();
> if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() ==
> false) return false;
> return true;
> }
>
> This will cause clientside validation to be fired AFTER I show my
> loading screen and hence the system "locks" if a clientside validator
> is triggered
>
> The next - to me - logical step would be to inject the following code
> via RegisterOnSubmitStatement
> if (typeof(ValidatorOnSubmit) == ""function"" && ValidatorOnSubmit() !=
> false) { page.loadingMessage.show(); }
>
> which produces
>
> function WebForm_OnSubmit() {
> if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() !=
> false) { page.loadingMessage.show(); };if (typeof(ValidatorOnSubmit) ==
> "function" && ValidatorOnSubmit() == false) return false;
> return true;
> }
>
> Homefree? Not yet as this will cause the clientside validator to fail
> and just go straight to postback instead.
>
> Any pointers are greatly appreciated.
>
> Brian


 
Reply With Quote
 
 
 
 
sebandres sebandres is offline
Junior Member
Join Date: Mar 2010
Posts: 1
 
      03-01-2010
I know this is a very old post but still, in case anyone needs it, here is how you can do it!

Javascript on the .aspx:

Code:
    function ShowErrors() {
        $find('<%= ModalPopupExtender1.ClientID %>').show(); //<-- Show PopUp
    }

 function CheckForClientSideErrors() {
        var bReturn = ValidatorOnSubmit(); //<-- validate the page clientside
        if (!bReturn) { //<-- Here you check if validation went ok or not and then show the popup
            ShowErrors();
        }
        return bReturn;
    }
On the Page_Load add this:

Code:
 Page.ClientScript.RegisterOnSubmitStatement(typeof(string), "Errors_ModalPopUp", "return CheckForClientSideErrors();");
And you are done!

Now you can add a ModalPopUpExtender to popup when a client side validation occurs without needing to do a PostBack!

Cheers!

Sebastian Andres
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
When using RegisterOnSubmitStatement eventhandlers are not fired APA ASP .Net 1 02-23-2007 01:22 PM
RegisterOnSubmitStatement not posting eventtarget APA ASP .Net 4 02-20-2007 11:14 PM
Loading/splash screen / RegisterOnSubmitStatement Brian Christensen ASP .Net Web Controls 0 08-29-2006 11:24 AM
RegisterOnSubmitStatement appear twice =?Utf-8?B?YW5hdA==?= ASP .Net 1 02-05-2006 02:38 PM
Page.RegisterOnSubmitStatement problem Gandalf ASP .Net 0 07-26-2003 12:17 PM



Advertisments