Tuesday, September 22, 2015

Asp.net Wizard control events

Suggested Videos
Part 35 - Multiview control in asp.net
Part 36 - Wizard control in asp.net
Part 37 - Asp.net Wizard control properties

Drag and drop a wizard control on the webform. Right click on the wizard control and select the properties. Click on the events icon. This displays all the events of the wizard control.

To generate the event handler method for ActiveStepChanged event, double click on the textbox next to the event. Follow the same process to generate the event handler methods for the rest of the events of the wizard control.



HTML of the aspx page:
<div style="font-family: Arial">
    <asp:Wizard ID="Wizard1" runat="server" 
        onactivestepchanged="Wizard1_ActiveStepChanged" 
        oncancelbuttonclick="Wizard1_CancelButtonClick" 
        onnextbuttonclick="Wizard1_NextButtonClick" 
        onfinishbuttonclick="Wizard1_FinishButtonClick" 
        onpreviousbuttonclick="Wizard1_PreviousButtonClick" 
        onsidebarbuttonclick="Wizard1_SideBarButtonClick">
        <SideBarStyle VerticalAlign="Top" />
        <WizardSteps>
            <asp:WizardStep runat="server" title="Step 1">
                <asp:CheckBox ID="chkBoxCancel" Text="Cancel Navigation" runat="server" />
            </asp:WizardStep>
            <asp:WizardStep runat="server" title="Step 2">
            </asp:WizardStep>
            <asp:WizardStep runat="server" title="Step 3">
            </asp:WizardStep>
        </WizardSteps>
    </asp:Wizard>
</div>



Code-Behind page code:
// ActiveStepChanged - Fires when the active step of the index is changed.
protected void Wizard1_ActiveStepChanged(object sender, EventArgs e)
{
    Response.Write("Active Step Changed to " + Wizard1.ActiveStepIndex.ToString() + "<br/>");
}
// CancelButtonClick - Fires when the cancel button of the wizard control is clicked. 
// To display the cancel button, set DisplayCancelButton=True.
protected void Wizard1_CancelButtonClick(object sender, EventArgs e)
{
    Response.Redirect("Cancel Button Clicked");
}
// NextButtonClick - Fires when the next button of the wizard control is clicked. 
protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
{
    Response.Write("Current Step Index = " + e.CurrentStepIndex.ToString() + "<br/>");
    Response.Write("Next Step Index = " + e.NextStepIndex.ToString() + "<br/>");
    if (chkBoxCancel.Checked)
    {
        Response.Write("Navigation to next step will be cancelled");
        e.Cancel = true;
    }
}
// FinishButtonClick - Fires when the finish button is clicked
protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
{
    Response.Write("Finish button clicked <br/>");
    Response.Write("Current Step Index = " + e.CurrentStepIndex.ToString() + "<br/>");
    Response.Write("Next Step Index = " + e.NextStepIndex.ToString());
}
// PreviousButtonClick - Fires when the previous button is clicked
protected void Wizard1_PreviousButtonClick(object sender, WizardNavigationEventArgs e)
{
    Response.Write("Previous button clicked<br/>");
}
// SideBarButtonClick - Fires when the sidebar button is clicked
protected void Wizard1_SideBarButtonClick(object sender, WizardNavigationEventArgs e)
{
    Response.Write("Sidebar button clicked<br/>");
}


If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website

0 comments:

Post a Comment