只是验证网络表单并收到以下错误 Everting工作正常,直到我编译并获得此错误的第34行。我的IDE没有错误 我已经运行了调试,无法生成或看到任何无效的
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Student Registration Form</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h3>Student Form</h3>
<table>
<tr>
<td>First Name</td>
<td>
<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfvFirstName" runat="server" ErrorMessage="Enter your First Name" ControlToValidate="txtFirstName" ValidationGroup="Submit"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>Last Name</td>
<td>
<asp:TextBox ID="txtLastName" runat="server"></asp:TextBox></td>
<asp:RequiredFieldValidator ID="rfvTxtLastName" runat="server" ErrorMessage="please enter your surname" ControlToValidate=" txtLastName" ValidationGroup="submit"></asp:RequiredFieldValidator>
</tr>
<tr>
<td>Email</td>
<td>
<asp:TextBox ID="txtEmail" runat="server"></asp:TextBox></td>
<asp:RegularExpressionValidator ID="revtxtEmail" runat="server" ErrorMessage="invalid Email Format" ControlToValidate="txtEmail" ValidationGroup="submit" ValidationExpression="^([\w\.\-]+)@([\w\-]+)((\.(\w){2,3})+)$"></asp:RegularExpressionValidator>
</tr>
<tr>
<td>Subjects Available</td>
<td>
<asp:ListBox ID="ltbSubjectsAvailable" runat="server"></asp:ListBox>
</td>
</tr>
<tr>
<td>Subjects Selected</td>
<td>
<asp:ListBox ID="ltbSubjectsSelected" runat="server"></asp:ListBox></td>
</tr>
<tr>
<td>Password</td>
<td>
<asp:TextBox ID="txtPassword" TextMode="Password" runat="server"></asp:TextBox></td>
<asp:RequiredFieldValidator ID="rfvTxtPassword" runat="server" ErrorMessage="Please enter password" ControlToValidate="txtPassword" ValidationGroup="Submit"></asp:RequiredFieldValidator>
</tr>
<tr>
<td>Confirm Password</td>
<td>
<asp:TextBox ID="txtPasswordChange" TextMode="Password" runat="server"></asp:TextBox></td>
<asp:CompareValidator ID="cpvChangePassword" runat="server" ErrorMessage="Passwords do not match" ControlToValidate=" textPasswordChange" ControlToCompare="txtPassword"></asp:CompareValidator>
</tr>
<tr>
<td>
<asp:Button ID="btnSubmit" runat="server" ValidationGroup="Submit" Text="Button" /></td>
</tr>
</table>
</div>
</form>
</body>
</html>
答案 0 :(得分:0)
也许这就是解决方案:在web.config中更改编译器版本
答案 1 :(得分:0)
如果您看到错误消息的底部
Asp.net版本是4.6 .net框架是4.0
确保您在正确的框架中进行编译。