0

我有一个asp.net 向导控件。我在步骤 3 中使用具有一些文本框的数据网格获取用户输入。网格也有填充了一些相关信息的标记。在第四步中,我将处理输入并创建一些配置。

现在我需要在第 3 步之后和第 4 步之前显示一个信息摘要,其中包括输入信息(文本框和标签)。我可以为摘要创建一个新的向导步骤并显示所有这些信息,但我必须创建一种类似的datagrid/(或其他方式)通过填充步骤 3 中的所有信息。相反,我可以重用步骤 3 datagrid 添加了一些标签以及文本框,并仅在摘要步骤期间显示它。但为了做到这一点,我必须违反向导概念,例如在下一个按钮单击期间取消当前步骤(e.cancel = true),并有一些标志再次重新加载同一步骤,我觉得这不合适方式。

你们有更好的方法来实现这一点吗?抱歉,如果问题令人困惑,我可以根据查询添加更多信息。

4

1 回答 1

0

如果要将其合并到当前向导中,则需要ActiveStepChanged手动处理事件,并使用向导历史记录来确定应加载哪个步骤。

这将使您访问的最后一步:

/// <summary>
/// Gets the last wizard step visited.
/// </summary>
/// <returns></returns>
private WizardStep GetLastStepVisited()
{
    //initialize a wizard step and default it to null
    WizardStep previousStep = null;

    //get the wizard navigation history and set the previous step to the first item
    var wizardHistoryList = (ArrayList)wzServiceOrder.GetHistory();
    if (wizardHistoryList.Count > 0)
        previousStep = (WizardStep)wizardHistoryList[0];

    //return the previous step
    return previousStep;
}

这是我前一段时间写的一些逻辑,与您尝试做的类似:

/// <summary>
/// Navigates the wizard to the appropriate step depending on certain conditions.
/// </summary>
/// <param name="currentStep">The active wizard step.</param>
private void NavigateToNextStep(WizardStepBase currentStep)
{
    //get the wizard navigation history and cast the collection as an array list 
    var wizardHistoryList = (ArrayList)wzServiceOrder.GetHistory();

    if (wizardHistoryList.Count > 0)
    {
        var previousStep = wizardHistoryList[0] as WizardStep;
        if (previousStep != null)
        {
            //determine which direction the wizard is moving so we can navigate to the correct step
            var stepForward = wzServiceOrder.WizardSteps.IndexOf(previousStep) < wzServiceOrder.WizardSteps.IndexOf(currentStep);

            if (currentStep == wsViewRecentWorkOrders)
            {
                //if there are no work orders for this site then skip the recent work orders step
                if (grdWorkOrders.Items.Count == 0)
                    wzServiceOrder.MoveTo(stepForward ? wsServiceDetail : wsSiteInformation);
            }
            else if (currentStep == wsExtensionDates)
            {
                //if no work order is selected then bypass the extension setup step
                if (grdWorkOrders.SelectedItems.Count == 0)
                    wzServiceOrder.MoveTo(stepForward ? wsServiceDetail : wsViewRecentWorkOrders);
            }
            else if (currentStep == wsSchedule)
            {
                //if a work order is selected then bypass the scheduling step
                if (grdWorkOrders.SelectedItems.Count > 0)
                    wzServiceOrder.MoveTo(stepForward ? wsServicePreview : wsServiceDetail);
            }
        }
    }
}
于 2013-03-09T16:50:57.177 回答