【问题标题】:How to add skip button to ASP.NET Wizard?如何向 ASP.NET 向导添加跳过按钮?
【发布时间】:2010-11-06 12:47:48
【问题描述】:

我知道如何以编程方式跳过步骤,但我也需要“跳过”按钮。

【问题讨论】:

  • 我的回答对你有好处吗?你需要更多细节吗?

标签: asp.net wizard


【解决方案1】:

如果您希望向向导控件添加新按钮,则需要通过创建自定义模板来替换现有模板

  1. WizardStepNavigationTemplates(这是负责在任何正常向导步骤中显示的控件的模板)
  2. WizardStartNavigationTemplate(这是负责在向导第一步时显示的控件的模板)和
  3. WizardFinishNavigationTemplate(这是负责在向导的最后一步显示的控件的模板)

    内部类 CustomWizardStartNavigationTemplate : CustomWizardNavigationTemplateBase { #region ITemplate 成员

        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
    
    }

    如下所示是如何实现预期结果的示例实现。请注意,通过创建这些新模板,您将需要添加我在示例中未显示的按钮单击事件等。因此,当用户单击按钮时,他们将被移至下一步等。希望这会有所帮助。

干杯 尼尔

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-06-29
    • 2021-04-19
    • 2015-03-29
    • 2012-11-09
    • 2011-01-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多