0
我有一個與RequiredFieldValidators,RegularExpressionValidators和PasswordStrength數據庫表連接的註冊表單,當我按下提交時,什麼都不會發生。任何線索爲什麼會發生這種情況?有解決方案嗎?requiredfieldvalidator註冊表單asp.net
<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>
<tr>
<td width="150"></td>
<td width="350"><asp:CheckBox ID="specialdeals" runat="server" /><div class="smtxt">Please send me Skyscanner emails with travel deals, special offers, and other information.</div></td>
</tr>
</table>
<hr align="left" width="500" />
<table width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="150"></td>
<td width="350" class="smtxt">Strong passwords are important protections to help you have safer online transactions. Wherever possible use letters, punctuation, symbols, and numbers to create strong passwords!</td>
</tr>
<tr>
<td width="150"><asp:Label ID="lblPassword" runat="server" Font-Names="Tahoma" Text="Password:"></asp:Label></td>
<td width="350"><asp:TextBox ID="txtPassword" TextMode="Password" MaxLength="30" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="txtPassword" Text="Minimum password length is 6" ErrorMessage="Minimum password length is 6" ValidationExpression=".{6}.*" />
<asp:PasswordStrength ID="PasswordStrength1" runat="server" TargetControlID="txtPassword"></asp:PasswordStrength>
</td>
</tr>
<tr>
<td width="150"></td>
<td width="350" class="smtxt">(6-30 characters, no spaces)</td>
</tr>
<tr>
<td width="150"><asp:Label ID="lblConfirmPassword" runat="server" Font-Names="Tahoma" Text="Re-type password:"></asp:Label></td>
<td width="350"><asp:TextBox ID="txtConfirmPassword" TextMode="Password" MaxLength="30" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" ControlToValidate="txtConfirmPassword" Text="Minimum password length is 6" ErrorMessage="Minimum password length is 6" ValidationExpression=".{6}.*" />
<asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="Passwords do not match!" Text="Passwords do not match!" ControlToValidate="txtConfirmPassword" ControlToCompare="txtPassword"></asp:CompareValidator>
</td>
</tr>
</table>
<hr align="left" width="500" />
<table width="500" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50"></td>
<td width="450"><asp:CheckBox ID="agree" runat="server" />I have read and agree to the <a href="#">Terms of Use</a> and the <a href="#">Privacy Policy</a>.</td>
</tr>
<tr>
<td width="50"></td>
<td width="450"><asp:ImageButton ID="ibRegister" runat="server" imageurl="images/register.png" borderwidth="0" OnClick="buttonRegister" /></td>
</tr>
</table>
</div>
</asp:Panel>
</div>
<asp:Label ID="lblConnect" runat="server"></asp:Label>
</form>
我檢查了驗證器,它們看起來對我來說不錯... – multiv123 2011-05-06 03:38:08
你能編輯你的問題嗎?發佈aspx頁面的代碼? – Avitus 2011-05-06 03:39:01
好的我發佈了代碼 – multiv123 2011-05-06 03:44:12