Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Loading/splash screen / RegisterOnSubmitStatement (http://www.velocityreviews.com/forums/t365830-loading-splash-screen-registeronsubmitstatement.html)

Brian Christensen 08-22-2006 06:57 AM

Loading/splash screen / RegisterOnSubmitStatement
 
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


Brian Christensen 08-29-2006 11:22 AM

Re: Loading/splash screen / RegisterOnSubmitStatement
 
<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



sebandres 03-01-2010 03:24 AM

ASP.Net AJAX Add loading or popup on client side validation
 
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


All times are GMT. The time now is 10:26 AM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57