StepNavigationTemplate在CreateUserWizard中不起作用?

时间:2012-11-21 23:07:23

标签: asp.net templates createuserwizard

我正在尝试设置StepNavigationTemplate,但它无法正常工作

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
    <StepNavigationTemplate>
        <asp:Button ID="StepPreviousButton" runat="server" CausesValidation="False" CommandName="MovePrevious" Text="Cancel" />
        <asp:Button ID="StepNextButton" runat="server" CommandName="MoveNext" Text="I Agree" />
    </StepNavigationTemplate>
    <WizardSteps>
        <asp:WizardStep runat="server" Title="Agree to Terms of Use">
        </asp:WizardStep>
    </WizardSteps>
</asp:CreateUserWizard>

它在这里什么也没做,但是当我把它放在<asp:WizardStep>里面时它起作用,但是它增加了导航按钮,而之前的那些仍然存在,所以它根本没用。这应该如何使用?

1 个答案:

答案 0 :(得分:0)

你的意思是这样的:

<WizardSteps>
<asp:WizardStep runat="server" Title="Your title" ID="wzsStep" StepType="Step"></asp:WizardStep >
.....
</WizardSteps>
<StepNavigationTemplate>

                        <asp:Button ID="uxPreviousStepBtn" Text="Previous" runat="server" CausesValidation="False"
                            Width="80" OnClick="uxPreviousStepBtn_Click" OnPreRender="uxPreviosStepBtn_PreRender" />

                        <asp:Button ID="uxNextStepBtn" Text="Next" runat="server" CausesValidation="True"
                            Width="80" ValidationGroup="MainData" OnClick="uxNextStepBtn_Click" OnPreRender="uxNextStepBtn_PreRender" />


            </StepNavigationTemplate>

protected void uxPreviousStepBtn_Click(object sender, EventArgs e)
{
//Previous step will show
 myWizard.ActiveStepIndex =myWizard.ActiveStepIndex>0? myWizard.ActiveStepIndex-1:0;
}        
protected void uxNextStepBtn_PreRender(object sender, EventArgs e)
    {
    //Check please if next step exists 
          myWizard.ActiveStepIndex =myWizard.ActiveStepIndex+1;
    }