如何向 ASP.NET 向导添加跳过按钮?

发布于 2024-09-30 21:49:39 字数 34 浏览 7 评论 0原文

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

I know how can I skip steps programmatically but I need "Skip" button too.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

沐歌 2024-10-07 21:49:39

如果您希望向向导控件添加新按钮,则需要通过创建自定义

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

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

     public CustomWizardStartNavigationTemplate(WizardDisplayConfig WizardDisplayConfig):base(wizardDisplayConfig){ }
    
    
    
    /// <摘要>
    /// 这会覆盖定义将出现在模板中的导航控件的方法。
    /// 文字控件用于在控件之间放置间距。
    /// 
    公共覆盖无效InstantiateIn(控制容器)
    {
        文字间距literal = new Literal();
        spaceliteral.Text += "&nbsp;";
        按钮 btnSkip = new Button();
        按钮 btnSave= new Button();
        按钮 btnNext= new Button();
    
    
         容器.Controls.Add(btnSave);
        容器.Controls.Add(spacingliteral);
        容器.Controls.Add(btnNext);
        容器.Controls.Add(spacingliteral);
        容器.Controls.Add(btnSkip);
    
    
    }
    #endregion
    

    }

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

干杯
尼尔

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 += "&nbsp;";
        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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文