CreatUserWizard自定义模板的实现

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
            <WizardSteps>
                <asp:CreateUserWizardStep runat="server">
                    <ContentTemplate>
                    &nbsp 注册新帐户<br/>
                    <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">用户名:
                    </asp:Label>
                    <asp:TextBox ID="UserName" runat="server">
                    </asp:TextBox>
                    <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                     ErrorMessage="必须填写“用户名”" ToolTip="必须填写“用户名”"
                      ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator> </br>
                   
                    <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">密码:
                    </asp:Label>
                    <asp:TextBox ID="Password" runat="server" TextMode="Password">
                    </asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="Password"
                     ErrorMessage="必须填写“密码”" ToolTip="必须填写“密码”"
                      ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator><br/>
                   
                      <asp:Label ID="ConfirmPasswordLabel" runat="server" AssociatedControlID="ConfirmPassword">确认密码:
                    </asp:Label>
                    <asp:TextBox ID="ConfirmPassword" runat="server">
                    </asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="ConfirmPassword"
                     ErrorMessage="必须填写“确认密码”" ToolTip="必须填写“确认密码”"
                      ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator>  <br />
                   
                    <asp:Label ID="EmailLabel" runat="server" AssociatedControlID="Email">电子邮件:
                    </asp:Label>
                    <asp:TextBox ID="Email" runat="server">
                    </asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="Email"
                     ErrorMessage="必须填写“电子邮件”" ToolTip="必须填写“电子邮件”"
                      ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator><br />
                     
                      <asp:Label ID="QuestionLabel" runat="server" AssociatedControlID="Quetion">安全提示问题:
                    </asp:Label>
                    <asp:TextBox ID="Quetion" runat="server">
                    </asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="Quetion"
                     ErrorMessage="必须填写“安全提示问题”" ToolTip="必须填写“安全提示问题”"
                      ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator><br />
                     
                      <asp:Label ID="AnswerLabel" runat="server" AssociatedControlID="UserName">安全答案:
                    </asp:Label>
                    <asp:TextBox ID="Answer" runat="server">
                    </asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="Answer"
                     ErrorMessage="必须填写“安全答案”" ToolTip="必须填写“安全答案”"
                      ValidationGroup="CreateUserWizard1">*</asp:RequiredFieldValidator><br />

                   <asp:CompareValidator ID="PasswordCompare" runat="server" ControlToCompare="Password"
                    ControlToValidate="ConfirmPassword" Display="Dynamic" ErrorMessage="“密码”和“确认密码”必须匹配。"
                     ValidationGroup="CreateUserWizard1"></asp:CompareValidator><br />

                     <asp:Literal ID="ErrorMessage" runat="server" EnableViewState="false"></asp:Literal>
                    </ContentTemplate>
                </asp:CreateUserWizardStep>
                <asp:CompleteWizardStep runat="server">
                    <ContentTemplate>
                        <table border="0">
                            <tr>
                                <td align="center" colspan="2">
                                完成
                                </td>
                            </tr>
                            <tr>
                                <td>
                                已成功创建您的帐户。
                                </td>
                            </tr>
                            <tr>
                                <td align="right" colspan="2">
                                    <asp:Button ID="ContinueButton" runat="server" CausesValidation="false"
                                     CommandName="Continue" Text="继续" ValidationGroup="CreateUserWizard1" />
                                </td>
                            </tr>
                        </table>
                    </ContentTemplate>
                </asp:CompleteWizardStep>
            </WizardSteps>
        </asp:CreateUserWizard>

但在模板里的控件的ID都是要固定设置的,如果更改会导致不可预测的错误!
posted @ 2008-06-18 20:54  不染丹心  阅读(480)  评论(0编辑  收藏  举报