Click here to Skip to main content
15,881,281 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,

I am making an Asp.Net page that requires validation.
Some of the validations if done by c# will have to be done using custom validations, hence causing Post-back and is not desirable for the project.
So I did that with java-script but now these validations occur even when any control causes post-back.
So is there a way to check if the control that caused submit, is supposed to cause validation, on submit() event of the page(i.e. Java-script).

Please help
Thanks
Posted
Comments
Divya RS 18-Oct-12 7:56am    
Post your code so that we can figure out your problem easier
AshishChaudha 19-Oct-12 0:02am    
Post your Javascript Function for validation.

1 solution

Example you have button ABC and XYZ and you have Textbox QWE.
You need to specify ValidationGroup.

Let say:
ASP.NET
<asp:textbox id="QWE" runat="server" validationgroup="Q"></asp:TextBox>

<asp:Button id="ABC" runat="server" validationgroup="Q"></asp:Button>
<asp:Button id="XYZ" runat="server"> </asp:Button>


or you can simply turnoff the validation of the XYZ button by setting the attribute to
HTML
CausesValidation='false'
 
Share this answer
 
v2
Comments
wizshrutz 19-Oct-12 0:37am    
I am aware of this property but even if CausesValidation is set to False the submit event(Javascript) gets fired and this is where i want to know if the Control's CausesValidation is set or not.
Jephunneh Malazarte 19-Oct-12 2:32am    
how about the validationgroup? because in my sample below when your textbox and your button have same validation group then other buttons will not cause the validation that does not belong to that group.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900