[英]Why does nothing happen when I press submit on my ASP.NET registration form?
I have a registration form that is connected to a database table that uses RequiredFieldValidators, RegularExpressionValidators, and PasswordStrength.我有一个注册表单,它连接到使用RequiredFieldValidators、RegularExpressionValidators 和PasswordStrength 的数据库表。 When I press submit, nothing happens.当我按下提交时,没有任何反应。 Any clue why this is happening?任何线索为什么会发生这种情况? Please can you help.请你能帮忙。 Thank you.谢谢你。
<form id="form1" runat="server">
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>
<div style="margin-left:30%;margin-top:40px;">
<asp:RoundedCornersExtender ID="RoundedCornersExtender1" runat="server" TargetControlID="MainPanel" BorderColor="blue" Radius="6" Corners="All"></asp:RoundedCornersExtender>
<asp:Panel ID="MainPanel" BackColor="Transparent" runat="server" BorderWidth="5" BorderStyle="Solid" BorderColor="blue" Width="525" Height="475">
<div style="margin-left:10px;margin-top:10px">
<h2 style="color:Blue;text-align:center">Registration</h2>
<table width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="150"><asp:Label ID="lblFirstname" runat="server" Font-Names="Tahoma" Text="First name:"></asp:Label></td>
<td width="350"><asp:TextBox ID="txtFirstname" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvFirstname" runat="server" ControlToValidate="txtFirstname" ErrorMessage="First name is required." ToolTip="First name is required."></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="150"><asp:Label ID="lblMiddlename" runat="server" Font-Names="Tahoma" Text="Middle name:"></asp:Label></td>
<td width="350"><asp:TextBox ID="txtMiddlename" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvMiddlename" runat="server" ControlToValidate="txtMiddlename" ErrorMessage="Middle name is required." ToolTip="Middle name is required."></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="150"><asp:Label ID="lblLastname" runat="server" Font-Names="Tahoma" Text="Last name:"></asp:Label></td>
<td width="350"><asp:TextBox ID="txtLastname" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvLastname" runat="server" ControlToValidate="txtLastname" ErrorMessage="Last name is required." ToolTip="Last name is required."></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="150"></td>
<td width="350" class="smtxt">Tip: Make sure the names match the traveler's passport or driver's license to avoid travel delays.</td></tr>
</table>
<hr align="left" width="500" />
<table width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="150"><asp:Label ID="lblUsername" runat="server" Font-Names="Tahoma" Text="Username:"></asp:Label></td>
<td width="350"><asp:TextBox ID="txtUsername" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvUsername" runat="server" ControlToValidate="txtUsername" ErrorMessage="Username is required."></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td width="150"><asp:Label ID="lblEmailAddress" runat="server" Font-Names="Tahoma" Text="Email address:"></asp:Label></td>
<td width="350"><asp:TextBox ID="txtEmailAddr" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" Text="You must enter an email address" ErrorMessage="You must enter an email address" Display="None" ControlToValidate="txtEmailAddr" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.w+([-.]\w+)*"></asp:RegularExpressionValidator>
</td>
</tr>
...
You are probably failing one of the validators requirements and just not displaying the error message.您可能没有满足验证器要求之一,只是没有显示错误消息。 I would look at your validators and make sure that they are not suppressing error messages or you're passing those messages to a summary control我会查看您的验证器并确保它们不会抑制错误消息,或者您将这些消息传递给摘要控件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.