Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4562110
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T18:10:11+00:00 2026-05-21T18:10:11+00:00

I am working in ASP.NET 3.5 with VB.NET as my server-side language. I am

  • 0

I am working in ASP.NET 3.5 with VB.NET as my server-side language. I am using JavaScript via jQuery 1.5.2 as my client-side language. I am trying to do a prototype / namespace setup with this page. This page is a custom logon page using MultiView. I have a Policy Logon view and a Forgot Password view. I am storing the ActiveViewIndex in a hidden field called currentView.

I’m using Partial Postbacks with the UpdatePanel in this project, and the JS doesn’t get refreshed on the Partial PostBacks.

That said, I need a way to wait for the ActiveViewIndex to get changed server-side, so that I can call the init() function to the respective view. Is this possible?

My client side code:

Global JS


var page = 
{                   
    currentView : getContentElement( "currentView" ),
    
    init : function () 
    { 
        log( "initializing page" );
                            
        if ( this.currentView === "forgotpassword" ) { forgotPassword.init(); }
        else { policyLogon.init(); }    
    }
}; 

page.init();

Policy Logon View JS


var policyLogon = 
{                       
    panel              : getContentElement( "pnlLogonInfo", "div" ),
    submitButton       : getContentElement( "btnLogon", this.panel ),
    textInputs         : $( "input[ type=text ]", this.panel ),
    policyNumber       : getContentElement( "txtPolicyNumber", this.textInputs ),
    policyNumberError  : getContentElement( "lblPolicyNumberError", this.panel ),
    password           : getContentElement( "txtPassword", this.textInputs ),
    passwordError      : getContentElement( "lblPasswordError", this.panel ),
    forgotPasswordLink : getContentElement( "lbtnForgotPassword", this.panel ),
                    
    init : function () 
    { 
        log( "initializing policy logon" );
                        
        var that = this;

        // Other event handlers created here [redacted to keep example code short].

        that.forgotPasswordLink.on("click", function () 
        {
            // Code to wait for PostBack should go here.

            page.init();
        });

        that.policyNumber.focus();              
    }
};

Forgot Password View JS


var forgotPassword = 
{
                            
    // Local vars, set up the same way as Policy Logon, just different elements.
    // [redacted to keep example code short]
                        
    init : function () 
    { 
        log( "initializing forgot password" );
                            
        var that = this;
    
        // Other event handlers created here [redacted to keep example code short].
    
        that.policyNumber.focus();                      
    }    
};


As a preemptive strike against the what is getContentElement() questions, getContentElement() is a function I had to create due to nested master pages where elements will have to be called differently based on what master page they are using. It looks like this:

function getContentElement ( id, context ) 
{ 
    var publicPrefix = csMasterPrefix + csContentPrefix,
        securePrefix = cpMasterPrefix + publicPrefix + cpContentPrefix,
        publicId = "#" + publicPrefix + id,
        secureId = "#" + securePrefix + id;
    
    return ( context )
        ? ( isSecurePage ) ? $( secureId, context ) : $( publicId, context )
        : ( isSecurePage ) ? $( secureId ) : $( publicId );
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T18:10:11+00:00Added an answer on May 21, 2026 at 6:10 pm

    Ok … so I answered my question, but not with anything special. I figured I could just use setInterval and continually check the page.currentView property. And instead of storing it continually, it will always be undefined except for when page.waitForViewChange sets it initially.

    Changed my Global JS to:

    var page = 
    {                               
        currentView : undefined,
        intervalId  : undefined,
    
        init : function () 
        { 
            log( "init() fired" );
    
            this.currentView = getContentElement( "currentView" ).val();
            log( "current view is [" + this.currentView + "]" );
    
            if ( this.currentView === "forgotpassword" ) { forgotPassword.init(); }
            else { policyLogon.init(); }
    
            clearInterval( this.intervalId );
            this.intervalId = undefined;
            this.currentView = undefined;
        },
    
        waitForViewChange : function ( viewToWaitFor ) 
        { 
            log ( "waitForViewChange() fired" );
    
            this.currentView = getContentElement( "currentView" ).val();
            if ( this.currentView === viewToWaitFor ) { this.init(); }          
        }
    };
    

    Then in my Policy Logon View JS I changed the forgotPasswordLink.click event to:

    this.forgotPasswordLink.on
    (
        "click", 
    
        function () 
        {     
            page.intervalId = setInterval
            ( 
                'page.waitForViewChange( "forgotpassword" )',
                300 
            ); 
        }
    );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am performing both clientside validation and server side validation using jquery and Asp.net
I'm trying to send data from client-side to server-side (asp.net c#), if you really
We are working on complex solution that contains ASP.Net-based server-side and several client applications
I’m working on trying to port an ASP.NET app from Server 2003 (and IIS6)
I have an ASP.NET MVC 2 form that is working perfectly, doing client side
I'm working with a table of asp.net controls on client side. They are all
I have an asp.net MVC server on one side and a silverlight 4 client
I am trying to create a simple ajax chat using JQuery and ASP.NET. My
So I am working on a project that uses a ASP.NET server and we
I am working on an ASP.NET website with sql server 2008 R2. i need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.