Loading/splash screen / RegisterOnSubmitStatement

Discussion in 'ASP .Net' started by Brian Christensen, Aug 22, 2006.

  1. 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, Aug 22, 2006
    #1
    1. Advertising

  2. <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
     
    Brian Christensen, Aug 29, 2006
    #2
    1. Advertising

  3. Brian Christensen

    sebandres

    Joined:
    Mar 1, 2010
    Messages:
    1
    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
     
    sebandres, Mar 1, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter Jausovec

    Re: creating Dyanamic splash screen

    Peter Jausovec, Mar 12, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    540
    Peter Jausovec
    Mar 12, 2005
  2. Frank
    Replies:
    0
    Views:
    496
    Frank
    Mar 12, 2005
  3. CodeMonkey
    Replies:
    0
    Views:
    418
    CodeMonkey
    Oct 11, 2005
  4. =?Utf-8?B?UnVkeQ==?=

    An upload splash screen?

    =?Utf-8?B?UnVkeQ==?=, Jul 7, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    628
    John Timney \(ASP.NET MVP\)
    Jul 10, 2005
  5. Brian Christensen

    Loading/splash screen / RegisterOnSubmitStatement

    Brian Christensen, Aug 29, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    118
    Brian Christensen
    Aug 29, 2006
Loading...

Share This Page