代码之家  ›  专栏  ›  技术社区  ›  Afshar Mohebi

如何将“跳过”按钮添加到ASP.NET向导中?

  •  0
  • Afshar Mohebi  · 技术社区  · 15 年前

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

    1 回复  |  直到 15 年前
        1
  •  0
  •   Somedeveloper    15 年前

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

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

      内部类CustomWizardStartNavigationTemplate:CustomWizardNavigationTemplateBase {

          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
      
      }

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

    干杯

    推荐文章