Renjith V S

Renjith V S

  • NA
  • 317
  • 64.6k

How to use more than one validator on button click ?

May 16 2014 12:42 AM
Hi,
     I have 2 text boxes and 3 drop down lists as mandatory fields. I am using javascript and asp .net validator for validation. When I click on the submit button all the 5 validator should work. But in my code only one validator is working.
My javascript code is:
var Page_IsValid = false;
Page_IsValid =Page_ClientValidate('valgrpCode');
Page_IsValid = Page_ClientValidate('valgrpDescription');
 Page_IsValid = Page_ClientValidate('valgrpCategory');
and my asp code is:
<asp:RequiredFieldValidator ID="reqCode" runat="server" ErrorMessage="*" ControlToValidate="txtCode" ValidationGroup="valgrpCode" ForeColor="Red"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="reqDescription" runat="server" ErrorMessage="*" ControlToValidate="txtDescription" ValidationGroup="valgrpDescription" ForeColor="Red"></asp:RequiredFieldValidator>
 
<asp:RequiredFieldValidator ID="reqCategory" runat="server" ErrorMessage="*" ControlToValidate="txtCategory" ValidationGroup="valgrpCategory" ForeColor="Red"></asp:RequiredFieldValidator>
 
and also here i am showing "*" as mandatory message.  But I need to change the color of label as mandatory message. I have added labels for each text boxes and drop down lists.
 
 
 
 

Answers (2)