CodeSnip: Simulating the ASP.NET 2.0 Wizard Control with ASP.NET 1.x.
page 5 of 5
by Tom Blanchard
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 27407/ 32

Working in the Code-behind File

In your code-behind file, add the following in the Page.Load method.

private void Page_Load(object sender, System.EventArgs e)
  {
   if(!Page.IsPostBack) {
    lb1.CssClass = "On";
    lb2.CssClass = "Off";
    lb3.CssClass = "Off";
    lb4.CssClass = "Off";
    pnl1.Style.Add("display", "inline");
    pnl2.Style.Add("display", "none");
    pnl3.Style.Add("display", "none");
    pnl4.Style.Add("display", "none");
   }
  }

This will show the first step when the page loads and all of the others will be hidden.  Double-click each link button and add the following code to their click event handlers:

private void lb1_Click(object sender, System.EventArgs e)
  {
   lb1.CssClass = "On";
   lb2.CssClass = "Off";
   lb3.CssClass = "Off";
   lb4.CssClass = "Off";
   pnl1.Style.Add("display", "inline");
   pnl2.Style.Add("display", "none");
   pnl3.Style.Add("display", "none");
   pnl4.Style.Add("display", "none");
  }
  private void lb2_Click(object sender, System.EventArgs e)
  {
   lb1.CssClass = "Off";
   lb2.CssClass = "On";
   lb3.CssClass = "Off";
   lb4.CssClass = "Off";
   pnl1.Style.Add("display", "none");
   pnl2.Style.Add("display", "inline");
   pnl3.Style.Add("display", "none");
   pnl4.Style.Add("display", "none");
  }
  private void lb3_Click(object sender, System.EventArgs e)
  {
   lb1.CssClass = "Off";
   lb2.CssClass = "Off";
   lb3.CssClass = "On";
   lb4.CssClass = "Off";
   pnl1.Style.Add("display", "none");
   pnl2.Style.Add("display", "none");
   pnl3.Style.Add("display", "inline");
   pnl4.Style.Add("display", "none");
  }</font>


<font face="Arial" size="2">  private void lb4_Click(object sender, System.EventArgs e)
  {
   lb1.CssClass = "Off";
   lb2.CssClass = "Off";
   lb3.CssClass = "Off";
   lb4.CssClass = "On";
   pnl1.Style.Add("display", "none");
   pnl2.Style.Add("display", "none");
   pnl3.Style.Add("display", "none");
   pnl4.Style.Add("display", "inline");  
  }

Now, you can build your project and view your webform in your browser by going to http://localhost/Wizard/WebForm1.aspx.

It should appear like this:

web page

You have now created a simulated wizard control in ASP.NET 1.x. Enjoy!


View Entire Article

User Comments

Title: Nice Job   
Name: Manish Jadhav
Date: 2008-03-11 1:20:42 PM
Comment:
That was a nice article. Thanks.
Title: Simulating the ASP.NET 2.0 Wizard Control with ASP.NET 1.x   
Name: Honey
Date: 2006-09-04 4:16:01 AM
Comment:
This is very helpful and excellent article
Title: CodeSnip: Simulating the ASP.NET 2.0 Wizard Control with ASP.NET 1.x.   
Name: Brian Law
Date: 2005-03-22 2:37:11 PM
Comment:
Thx~....Your guide is cool..I've modify your guide and successfully create a Prev Next Wizard base on your tutorial.
Title: < Prev Next>   
Name: Tom Blanchard
Date: 2005-03-15 5:30:03 PM
Comment:
Manish, I will be adding some more articles in relation to this one very soon. The next one I was planning was on how to handle this behaviour client side.

I will take your idea under consideration and maybe do a third one that contains and idea for that, as well as, building the interface from a database query.

Tom
Title: CodeSnip: Simulating the ASP.NET 2.0 Wizard Control with ASP.NET 1.x.   
Name: Manish Jadhav
Date: 2005-03-15 5:17:59 PM
Comment:
Nice article.
Do you have any sample that demonstrates the "Next" & "Previous" kind of wizard interface?

- Manish Jadhav
Title: CodeSnip: Simulating the ASP.NET 2.0 Wizard Control with ASP.NET 1.x.   
Name: Mark Priestap
Date: 2005-02-21 10:01:44 AM
Comment:
This was a brilliant article.
Title: CodeSnip: Simulating the ASP.NET 2.0 Wizard Control with ASP.NET 1.x.   
Name: Simon
Date: 2005-02-02 3:14:38 PM
Comment:
This was a brilliant article. Thanks for the great details.






Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-03-29 2:19:30 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search