Wizard and its steps (C#) : Wizard « ASP.net Controls « ASP.NET Tutorial

ASP.NET Tutorial
1. ASP.Net Instroduction
2. Language Basics
3. ASP.net Controls
4. HTML Controls
5. Page Lifecycle
6. Response
7. Collections
8. Validation
9. Development
10. File Directory
11. Sessions
12. Cookie
13. Cache
14. Custom Controls
15. Profile
16. Configuration
17. LINQ
18. ADO.net Database
19. Data Binding
20. Ajax
21. Authentication Authorization
22. I18N
23. Mobile
24. WebPart
25. XML
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
ASP.NET Tutorial » ASP.net Controls » Wizard 
3. 29. 4. Wizard and its steps (C#)
File: Default.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="WizardGreetingCardMaker" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Greeting Card Wizard</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0" BackColor="LemonChiffon" BorderStyle="Groove" BorderWidth="2px" CellPadding="10" OnFinishButtonClick="Wizard1_FinishButtonClick" Width="456px">
            <WizardSteps>
                <asp:WizardStep runat="server" Title="Step 1 - Colors">
                Choose a foreground (textcolor:<br  />
                <asp:DropDownList ID="lstForeColor" runat="server" Width="194px">
                </asp:DropDownList><br/>
                <br  />
                Choose a background color:<br  />
                <asp:DropDownList ID="lstBackColor" runat="server" Width="194px">
                </asp:DropDownList>                          
                
                </asp:WizardStep>
                <asp:WizardStep runat="server" Title="Step 2 - Background">
                
                    Choose a border style:<br  />
                <asp:RadioButtonList ID="lstBorder" runat="server" 
                    Height="59px" RepeatColumns="2" Width="177px">
                </asp:RadioButtonList><br  />
                <br  />
                <asp:CheckBox ID="chkPicture" runat="server" 
                    Text="Add the Default Picture"  />                
                
                </asp:WizardStep>
                <asp:WizardStep runat="server" Title="Step 3 - Text">
                
                
                Choose a font name:<br  />
                <asp:DropDownList ID="lstFontName" runat="server"  Width="194px">
                </asp:DropDownList><br  />
                <br  />
                Specify a font size:<br  />
                <asp:TextBox ID="txtFontSize" runat="server" ></asp:TextBox><br  />
                <br  />
                Enter the greeting text below:<br  />
                <asp:TextBox ID="txtGreeting" runat="server" 
                    TextMode="MultiLine" Width="240px" ></asp:TextBox>
                
                </asp:WizardStep>
                <asp:WizardStep runat="server" StepType="Complete" Title="Greeting Card">
                <asp:Panel ID="pnlCard" runat="server" Height="445px" HorizontalAlign="Center" Style="z-index: 101;" Width="339px">
            <br />
            &nbsp;
            <asp:Label ID="lblGreeting" runat="server" Height="150px" Width="272px"></asp:Label>
            <asp:Image ID="imgDefault" runat="server" Height="160px" Visible="False" Width="212px" /></asp:Panel>
                </asp:WizardStep>
            </WizardSteps>
        </asp:Wizard>
    
    </div>
    </form>
</body>
</html>


File: Default.aspx.cs

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Drawing;
using System.ComponentModel;

public partial class WizardGreetingCardMaker : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            string[] colorArray = Enum.GetNames(typeof(System.Drawing.KnownColor));
            lstBackColor.DataSource = colorArray;
            lstBackColor.DataBind();

            lstForeColor.DataSource = colorArray;
            lstForeColor.DataBind();
            lstForeColor.SelectedIndex = 34;
            lstBackColor.SelectedIndex = 163;

            System.Drawing.Text.InstalledFontCollection fonts;
            fonts = new System.Drawing.Text.InstalledFontCollection();
            foreach (FontFamily family in fonts.Families)
            {
                lstFontName.Items.Add(family.Name);
            }

            string[] borderStyleArray = Enum.GetNames(typeof(BorderStyle));
            lstBorder.DataSource = borderStyleArray;
            lstBorder.DataBind();

            lstBorder.SelectedIndex = 0;

            imgDefault.ImageUrl = "http://www.java2java.com/style/logo.png";
        }
    }
    protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
    {
        pnlCard.BackColor = Color.FromName(lstBackColor.SelectedItem.Text);
        lblGreeting.ForeColor = Color.FromName(lstForeColor.SelectedItem.Text);

        lblGreeting.Font.Name = lstFontName.SelectedItem.Text;
        try
        {
            if (Int32.Parse(txtFontSize.Text0)
            {
                lblGreeting.Font.Size = FontUnit.Point(Int32.Parse(txtFontSize.Text));
            }

            if (Int32.Parse(txtFontSize.Text0)
            {
                lblGreeting.Font.Size =
                    FontUnit.Point(Int32.Parse(txtFontSize.Text));
            }
        }
        catch
        {
        }

        TypeConverter cnvrt = TypeDescriptor.GetConverter(typeof(BorderStyle));

        pnlCard.BorderStyle = (BorderStyle)cnvrt.ConvertFromString(lstBorder.SelectedItem.Text);

        if (chkPicture.Checked == true)
        {
            imgDefault.Visible = true;
        }
        else
        {
            imgDefault.Visible = false;
        }
        lblGreeting.Text = txtGreeting.Text;
    }
}
3. 29. Wizard
3. 29. 1. Displaying a Wizard
3. 29. 2. A simple Wizard control (C#)
3. 29. 3. A simple Wizard control (VB)
3. 29. 4. Wizard and its steps (C#)
3. 29. 5. WizardStep
3. 29. 6. Custom wizard navigation
3. 29. 7. Custom wizard
3. 29. 8. Help Example Wizard
3. 29. 9. Wizard template
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.