Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ASP.NET:我怎么能;显示:无“;ASP验证程序何时不需要?_C#_Asp.net - Fatal编程技术网

C# ASP.NET:我怎么能;显示:无“;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代码:

 <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完美!太谢谢你了,修好了。