开发者

How to add skip button to ASP.NET Wizard?

I know how c开发者_StackOverflowan I skip steps programmatically but I need "Skip" button too.


If you wish to add a new button to the wizard control then you will need to replace the existing Templates by creating custom

  1. WizardStepNavigationTemplates(this is the template which is responsible for the controls which are displayed when on any normal wizard step)
  2. WizardStartNavigationTemplate(this is the template which is responsible for the controls which are displayed when on the FIRST step of the wizard) and
  3. WizardFinishNavigationTemplate (this is the template which is responsible for the controls which are displayed when on the Last step of the wizard)

    internal class CustomWizardStartNavigationTemplate : CustomWizardNavigationTemplateBase { #region ITemplate Members

        public CustomWizardStartNavigationTemplate(WizardDisplayConfig wizardDisplayConfig):base(wizardDisplayConfig){ }
    
    
    
    /// <summary>
    /// this overrides the method to define the navigation controls which will appear in the template.
    /// Literal control is used to put spacing between the controls.
    /// </summary>
    public override void InstantiateIn(Control container)
    {
        Literal spacingliteral = new Literal();
        spacingliteral.Text += " ";
        Button btnSkip = new Button();
        Button btnSave= new Button();
        Button btnNext= new Button();
    
    
         container.Controls.Add(btnSave);
        container.Controls.Add(spacingliteral);
        container.Controls.Add(btnNext);
        container.Controls.Add(spacingliteral);
        container.Controls.Add(btnSkip);
    
    
    }
    #endregion
    
    }

    Something like below is a sample implementation of how you can achieve the desired results. Note that by creating these new templates you will need to add button click events etc which i have not shown in my example. This is so when user clicks the button they will be moved to the next step etc.Hope this helps.

cheers Niall

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜