July 25, 2013

Code Example for Wizard Server Control in ASP.NET

Below is the code example for wizard control in ASP.NET

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>

<body>
    <form id="form1" runat="server">
    <div>
    <asp:wizard ID="Wizard1" runat="server" DisplayCancelButton="True"> 
     <WizardSteps> <asp:WizardStep ID="WizardStep1" title="Personal Info"  runat="server">
             Name <asp:TextBox ID="txtName" runat="server"/><br />
             Phone  <asp:TextBox ID="txtPhone" runat="server"/>
      
     </asp:WizardStep> 

     <asp:WizardStep ID="WizardStep2" title="Company Info"     runat="server">
              Company Name <asp:TextBox ID="txtCompName" runat="server"/><br />
              Company Phone <asp:TextBox ID="txtCompPhone" runat="server" />
      </asp:WizardStep>   
         <asp:WizardStep runat="server" StepType="Complete">

        
         <asp:Label runat="server" Text="" id="lblPersonal"></asp:Label>
         <asp:Label runat="server" Text="" id="lblComp"></asp:Label> </asp:WizardStep>
     </WizardSteps> </asp:wizard>
    </div>
    </form>
</body>
</html>


using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ExWizard : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        lblPersonal.Text = txtName.Text + "  " + txtPhone.Text;
        Response.Write("<br/>");
        lblComp.Text = txtCompName.Text + "  " + txtCompPhone.Text;
    }
}



No comments:

Post a Comment