Mandar Jogalekar
Mandar Jogalekar

Reputation: 3281

asp.net wizard and user control

i have wizard control with multiple steps. something like this

    <asp:wizard>
    <wizardsteps>

   </wizardsteps>
  <wizardsteps>

   </wizardsteps>
   <wizardsteps>
     <usercontrol>
   </wizardsteps>

the last step user control is the issue which is loading every time page is posted back and not just when particular step loads . that is making page slow. how can i possibly load user control when particular step is loaded

Upvotes: 0

Views: 1413

Answers (2)

SalataLuc
SalataLuc

Reputation: 410

To load your UC only when the step three is on, you can add an event in your Wizard and try something like this:

    protected void wizIndex_ActiveStepChanged(object sender, EventArgs e)
    {
        try
        {
            if (wizIndex.ActiveStepIndex == 2)
            {
                //Load UC
            }
        }
        catch
        {
            throw;
        }
    }

And then, you should remove the UC from your ASPX.

Upvotes: 0

Simon Wang
Simon Wang

Reputation: 2943

Dynamically load your control in the code behind, check this: How to: Create Instances of ASP.NET User Controls Programmatically

Upvotes: 1

Related Questions