1

Here is aspx :

<asp:TextBox ID="txt_name" runat="server" CssClass="input_class" ValidationGroup="A"></asp:TextBox>
<asp:RequiredFieldValidator ID="rfv_txt_name" runat="server" ErrorMessage="Please enter your name." ValidationGroup="A" Text="The field is required." Display="Dynamic" ControlToValidate="txt_name" CssClass="rfv_class" ToolTip="The field is required."></asp:RequiredFieldValidator>
<asp:Button ID="btn_contact" runat="server" Text="Send Message" ValidationGroup="A" />
<asp:ValidationSummary ID="Validation_Summary_1" runat="server" ValidationGroup="A"/>

When txt_name is empty & click on btn_contact, Validation_Summary_1's message = Please enter your name. + RequiredFieldValidator's text = The field is required. show up.

Now when i click on txt_name & type something & click outside of this textbox RequiredFieldValidator's text = The field is required. is vanished.

But Validation_Summary_1's message = Please enter your name. is still there until i click on btn_contact.

How can i update Validation_Summary_1 by click on outside of txt_name?

SilverLight
  • 19,668
  • 65
  • 192
  • 300
  • https://stackoverflow.com/questions/2915830/reset-an-asp-net-validation-control-via-javascript – 4b0 Jan 08 '20 at 09:18

1 Answers1

0

Use the code below for client side validation & also update ValidationSummary in JavaScript :

Page_ClientValidate("Your_Validation_Group");

Page_ClientValidate - Use This Method From Javascript for ASP.Net Client Side Validation

With the code below you can check if page is valid or not :

Page_IsValid
SilverLight
  • 19,668
  • 65
  • 192
  • 300