ASP.NET Wizard 控件的缺点

发布于 2024-10-13 17:47:24 字数 107 浏览 6 评论 0原文

我正在评估 ASP.NET 向导控件。我们需要从不同步骤收集数据、验证数据,最后我应该能够显示数据摘要。

我想知道小组中是否有人使用过此控件以及他们遇到了什么问题。该控件有使用限制吗?

I am in the process of evaluating the ASP.NET Wizard Control. Where we need to collect data from different steps, validate data and towards the end I should be able to show a data summary.

I would like to know from the group if anyone has used this control and what issues they faced. Are there any usage limitations with this control?

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

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

发布评论

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

评论(2

指尖微凉心微凉 2024-10-20 17:47:24

如果使用得当,向导控件可以为您节省大量的管道时间 - 然而,学习如何良好地使用它可能会花费您比节省的管道时间更多的费用。如果您打算重复使用它,那么最初投资于了解其特性可能是值得的。

我构建了一个向导,其中侧栏中显示的步骤取决于您所处的步骤(以及您在该点上所做的操作)。因此,当您按“下一步”或“上一步”时转到的步骤也是动态确定的。

为了实现这一点,我阅读了很多有关动态禁用步骤、隐藏步骤以及添加和删除步骤的内容。后者让我对 ViewState 陷入了深渊。对于它的价值,这是我的基本方法:

您可以通过将步骤 ID(和标题,如果设置)设置为空字符串来控制哪些步骤在侧栏中可见,例如我在 arrWizardSteps() 和我的步骤中有步骤名称定义为整型常量,然后使用

  For i = intCREDENTIALS To intADDITIONAL_INFORMATION
    Wizard1.WizardSteps(i).ID = IIf(Wizard1.ActiveStepIndex < i, "", arrWizardSteps(i))
  Next

如果步骤相对独立,则可以通过调用相同的例程来处理 SideBarButtonClick、PreviousButtonClick 和 NextButtonClick 事件,您构造该例程来处理离开当前步骤并进入下一个步骤,无论您使用哪个按钮单击以进行转换。例如,例程可能会存储当前步骤的控件捕获的数据,并将一些数据加载到下一步的控件中。

如果您确实处理这些事件,您可能需要自己处理 ActiveStepIndex 的更改。如果您不更改 ActiveStepIndex(取决于按下的按钮),向导将递增/递减 ActiveStepIndex(除非您在处理程序中设置 e.Cancel=true,其中 e 是处理程序的 WizardNavigationEventArgs 参数)。

如果用于隐藏步骤的代码需要知道目标步骤,那么您需要将该代码放入 PreRender 中,因为此时向导将移至下一步,您将知道它是什么。

The Wizard control can save you a lot of plumbing time if you use it well - however, learning to use it well may cost you more than the plumbing time that you save. If you plan to reuse it, then the initial investment in learning about its idiosyncracies may be worth it.

I have built a wizard in which the steps displayed in the side bar depend on which step you are at (and on what you have done to that point). It follows that the step you go to when you press Next or Previous is also determined dynamically.

To implement this, I read a lot of stuff about dynamically disabling steps, hiding steps, and adding and deleting steps. The latter led me into deep water with the ViewState. For what it is worth, here is my basic approach:

You can control which steps are visible in the sidebar by setting the step ID (and Title if set) to an empty string e.g. I have the step names in arrWizardSteps() and my steps defined as integer constants, then use

  For i = intCREDENTIALS To intADDITIONAL_INFORMATION
    Wizard1.WizardSteps(i).ID = IIf(Wizard1.ActiveStepIndex < i, "", arrWizardSteps(i))
  Next

If the steps are relatively independent, you can handle the SideBarButtonClick, PreviousButtonClick and NextButtonClick events by calling the same routine, which you construct to handle leaving the current step, and entering the next, irrespective of which button you clicked to make the transition. For example, the routine might store the data captured by the controls of the current step, and load some data into the controls of the next step.

If you do handle these events, you probably need to handle changing the ActiveStepIndex yourself. The wizard will increment/decrement the ActiveStepIndex (depending on which button was pressed) if you don't change it (unless you set e.Cancel=true in your handler where e is the WizardNavigationEventArgs argument to the handler).

If your code for hiding steps needs to know the destination step then you need to put that code in PreRender, since at that point the wizard will have moved to the next step and you will know what it is.

深居我梦 2024-10-20 17:47:24

我个人不喜欢向导控件。它相当僵化,我觉得它不太好用。从那时起,我在向导的每个步骤中都使用了内部的 MultiView 控件和每个视图中带有用户控件的 UpdatePanel。这样就可以完全灵活了。

通过多视图方法,您还可以在设计器中轻松查看向导的所有步骤。

不过,这只是我对控件的选择,我在第一次访问时并没有给它太多机会。

Personally I don't like the wizard control. Its quite rigid and I didn't find it very nice to work with. Since then I have used the MultiView control inside and UpdatePanel with User controls in each View for each step for my wizards. This way it can be completely flexible.

With the MultiView approach you can also see all steps of the wizard easily in the designer.

This is just my option on the control though, I didnt give it much of a chance on its first visit.

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