C# ASP.NET:我怎么能;显示:无“;ASP验证程序何时不需要?
我有以下asp代码:C# ASP.NET:我怎么能;显示:无“;ASP验证程序何时不需要?,c#,asp.net,C#,Asp.net,我有以下asp代码: <asp:TextBox ID="txtNewPassword" TextMode="Password" Placeholder="New Password" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="RequiredFieldValidatorNewPassword" runat="server" ErrorMessage="New Passwo
<asp:TextBox ID="txtNewPassword" TextMode="Password" Placeholder="New Password" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidatorNewPassword"
runat="server" ErrorMessage="New Password required" ControlToValidate="txtNewPassword" ForeColor="Red">
</asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ErrorMessage="Password must be at least 6 characters long" ForeColor="Red" ControlToValidate="txtNewPassword"
ValidationExpression="[0-9a-zA-Z]{6,}"/>
问题是它们隐藏在可见的地方,而不是在不需要的时候显示出来,但这是一个问题,因为它们占用了空间 使用此type=“hidden”或使用Style=“display:none”将
display=“Dynamic”
添加到验证器。@vdwd完美!太谢谢你了,修好了。