有谁知道如何删除“无效拉链”的空白。? 原因是它的左侧还有另一个验证,以确保它只是数字。但如果它不可见,我希望文本向左移动。如果您查看上面的 DOB,您可以看到两个验证都处于活动状态,因此看起来还不错。但我希望无效的 zip 向左移动。
这是asp代码:
<tr>
<td class="style2">Date of Birth [mm/dd/yyyy]</td>
<td class="style1">
<asp:TextBox ID="txtDOB" runat="server"
Width="268px" MaxLength="10"></asp:TextBox><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ErrorMessage="Date of birth is required." ControlToValidate="txtDOB"
Display="Dynamic" ForeColor="Red"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator1" runat="server"
ControlToValidate="txtDOB" Display="Dynamic"
ErrorMessage="Date of birth must be a valid date." ForeColor="Red"
MaximumValue="01/01/2013" MinimumValue="01/01/1909" Type="Date"></asp:RangeValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator4" runat="server" ControlToValidate="txtDOB"
ErrorMessage="Spaces are not allowed!" ValidationExpression="[^\s]+" ForeColor="Red"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="style2">Zip</td>
<td class="style1">
<asp:TextBox ID="txtZip" runat="server" Width="177px" MaxLength="9"></asp:TextBox><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ErrorMessage="Zip code is required." ControlToValidate="txtZip"
Display="Dynamic" ForeColor="Red" SetFocusOnError="True"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator5" runat="server" ControlToValidate="txtZip"
ErrorMessage="Spaces are not allowed!" ValidationExpression="[^\s]+" ForeColor="Red"></asp:RegularExpressionValidator>
<asp:RangeValidator ID="RangeValidator3" runat="server"
ErrorMessage="Invalid zip." ControlToValidate="txtZip" MaximumValue="999999999"
MinimumValue="0" SetFocusOnError="True" ForeColor="Red"></asp:RangeValidator>
</td>
</tr>
这是 VS2010 中的样子