Source code location: ./wizard/custom_wizard.cs
using System.Web.UI.WebControls; using System; using System.Web.UI; namespace CFC.Web.UI.Controls { public class CfcWizard : Wizard { private int previousStepIndex = -1; // ------------------------------------------------------------------------ public CfcWizard () : base() { this.Init += new EventHandler (CfcWizard_Init); this.NextButtonClick += new WizardNavigationEventHandler (CfcWizard_NextButtonClick); this.PreviousButtonClick += new WizardNavigationEventHandler (CfcWizard_PreviousButtonClick); } // ------------------------------------------------------------------------ void CfcWizard_Init (object sender, EventArgs e) { Page.RegisterRequiresControlState (this); Width = Unit.Percentage (100); DisplaySideBar = false; DisplayCancelButton = true; /* Additional visual fudging */ StartNextButtonText = StepNextButtonText = Resources.Next; StepPreviousButtonText = FinishPreviousButtonText = Resources.Previous; FinishCompleteButtonText = Resources.Finish; CancelButtonText = Resources.Cancel; } // ------------------------------------------------------------------------ void CfcWizard_PreviousButtonClick (object sender, WizardNavigationEventArgs e) { this.PreviousStepIndex = e.CurrentStepIndex; } // ------------------------------------------------------------------------ void CfcWizard_NextButtonClick (object sender, WizardNavigationEventArgs e) { this.PreviousStepIndex = e.CurrentStepIndex; } // ------------------------------------------------------------------------ public int PreviousStepIndex { get { return previousStepIndex; } set { previousStepIndex = value; } } // ------------------------------------------------------------------------ protected override object SaveControlState () { Pair newState = new Pair (); newState.First = base.SaveControlState (); if (previousStepIndex != -1) newState.Second = (object) previousStepIndex; return newState; } // ------------------------------------------------------------------------ protected override void LoadControlState (object state) { if (state == null) return; Pair newState = (Pair) state; base.LoadControlState (newState.First); if (newState.Second != null) previousStepIndex = (int) newState.Second; } } }
Copyright © 2004-2006, Milan Negovan. All rights reserved. | License
Back to AspNetResources.com