Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. generate wizard steps automatically

generate wizard steps automatically

Scheduled Pinned Locked Moved ASP.NET
tutorial
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Naif_Prof
    wrote on last edited by
    #1

    Hi, how we can generate wizard steps automatically base on variable for example when page load check the value of the variable and then crate wizard steps equal to the value of variable and then set the property of each step. Thanks a ot :doh: :wtf: :confused:

    M 1 Reply Last reply
    0
    • N Naif_Prof

      Hi, how we can generate wizard steps automatically base on variable for example when page load check the value of the variable and then crate wizard steps equal to the value of variable and then set the property of each step. Thanks a ot :doh: :wtf: :confused:

      M Offline
      M Offline
      Mike Ellison
      wrote on last edited by
      #2

      Here is a simple example of programmatically creating wizard steps. The trick is to create the steps in the PreInit event of the page.

      <%@ Page Language="C#" %>

      <script runat="server">
      void Page_PreInit(object o, EventArgs e)
      {
      // simple data for constructing this wizard
      string[] data = new string[3] {"What is your name? "
      ,"What is your quest? "
      ,"What is your favorite color? "
      };

      for (int i=0; i<data.Length; i++)
      {
          WizardStep theStep = new WizardStep();
          theStep.ID = "Step" + i.ToString();
          theStep.Title = "Step " + i.ToString();
          theStep.StepType = WizardStepType.Auto;
      
          // add some controls to the first step
          Label label1 = new Label();
          label1.Text = "<br />" + data\[i\] + "<br />";
          theStep.Controls.Add(label1);
          TextBox tb1 = new TextBox();
          tb1.ID = "txt" + i.ToString();
          theStep.Controls.Add(tb1);
      
          // add the step to the wizard
          wiz1.WizardSteps.Add(theStep);   
      }
      
      // set the active step to the first
      wiz1.ActiveStepIndex=0;
      

      }

      </script>

      <html>
      <head></head>
      <body>
      <form runat="server">
      <h3>Programmatically Adding Steps to Wizard</h3>
      <hr />
      <asp:Wizard id="wiz1" runat="server"
      DisplaySideBar="true"
      HeaderText="Wiz1"
      BorderWidth="1" BorderColor="#CCCCCC" BorderStyle="Solid"
      StepNextButtonText=" Next >> "
      StepPreviousButtonText=" << Previous "
      FinishCompleteButtonText=" Done! "
      CellPadding="4"
      >
      <HeaderStyle BackColor="#999999"
      ForeColor="#FFFFFF"
      HorizontalAlign="center"
      Font-Size="12" Font-Bold="True"
      />
      <SideBarStyle BackColor="#EFEFEF"
      />

         </asp:Wizard>                  
        <hr />
      </form>    
      

      </body>
      </html>

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups