CreateUserWizard-如何在向导过程中根据数据库验证数据?
我正在使用 asp.net CreateUserWizard 控件。 我添加了一个 WizardStep,并需要它在允许用户创建帐户之前根据我们的内部数据库验证 3 个数据点。 但是,当我尝试将下一个按钮单击连接到代码隐藏方法以检查数据时,该事件永远不会在代码隐藏中触发。
下面是“下一步”按钮上的代码 -
<asp:Button ID="StepNextButton" runat="server" BackColor="#FFFBFF"
BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px"
CommandName="MoveNext" Font-Names="Verdana" ForeColor="#284775"
Text="Next" onclick="StepNextButton_Click1" />
应该这样连接吗? 向导是否为您提供了一种方法来确定您正在进行哪个步骤,这样您就不必检查每个步骤?
还有一个问题。 为了有效地利用基于表单的身份验证并跟踪用户当前是否登录,在我看来,所有页面都需要包装在 LoginView 控件中,这样如果会话过期,他们就会看到“未登录”登录'模板视图? 正确的?
I'm using the asp.net CreateUserWizard control. I've added a WizardStep and need it to verify 3 datapoints against our internal database before allowing the user to create an account. However, when I try to wire the next button click to a codebehind method to check the data, the event never fires in the codebehind.
Below is the code on the Next button-
<asp:Button ID="StepNextButton" runat="server" BackColor="#FFFBFF"
BorderColor="#CCCCCC" BorderStyle="Solid" BorderWidth="1px"
CommandName="MoveNext" Font-Names="Verdana" ForeColor="#284775"
Text="Next" onclick="StepNextButton_Click1" />
Should it be wired this way? Does the Wizard give you a way to determine which step you're on so you're not checking for every step?
One more question. In order to effectively take advantage of Forms Based Auth and tracking if the user is curently logged in or not, it appears to me that all of the pages need to be wrapped in a LoginView control so if their session expires, they view the 'Not logged in' template view? Correct?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
简单的部分答案:
劫持 onclick 事件来调用您自己的函数。 检查您的数据库并调用 StepNextButton_Click1 (确保为此传递适当的调用者和参数)如果一切正常。 否则,您可以使页面无效和/或重定向用户。
Simple partial answer:
Hijack the onclick event to call your own function. Check against your DB and call StepNextButton_Click1 (make sure to pass appropriate caller and args for this) if all is well. Otherwise you can invalidate the page and/or redirect users.