有没有办法得到ASP.NET验证汇总控件只是显示HeaderText当有验证错误?
基本上我想要的只是一个简单的消息,如“请填写所有标记*的所有字段”出现在提交按钮旁边.当我在验证器上使用“*”的错误消息时,我不希望这些显示在摘要中.
感谢任何帮助.
解决方法
将每个验证器文本设置为“*”,将ErrorMessage设置为空字符串.
<form id="form2" runat="server"> Name:<br /> <asp:TextBox ID="NameTextBox" runat="server" /> <asp:requiredFieldValidator ID="NameTextBoxrequiredValidator" ControlToValidate="NameTextBox" ErrorMessage="" Text="*" runat="server" /> <br /> City:<br /> <asp:TextBox ID="CityTextBox" runat="server" /> <asp:requiredFieldValidator ID="CityTextBoxrequiredValidator" ControlToValidate="CityTextBox" ErrorMessage="" Text="*" runat="server" /> <br /> <asp:Button ID="SubmitButton" Text="Submit" runat="server" /> <hr /> <asp:ValidationSummary ID="valSum" DisplayMode="SingleParagraph" HeaderText="Please complete all fields marked *" runat="server" /> </form>