Geeks With Blogs
AngelEyes on .Net Tips, tricks and WTFs about Asp .Net, SQL Server and the likes.

I ran into a problem where the CustomValidator OnServerValidate not Firing.

After a lot of trial-and-error checking, I found out, the problem was that it didn't tolerate the yellow brackets. No errors were thrown, which was very frustrating.

This is what didn't work, to make it work, all i had to do was move the error to the code-behind:

<asp:CustomValidator ID="DiscountCouponCodeValidator" runat="server"

ErrorMessage="<div class='blizz-form-field-row-err' style='padding:0 25px;width:325px;margin-left:20px;margin-top:-15'><%# RM.GetString("VALID_COUPON_ERROR") %>" OnServerValidate="ValidateCoupon"></asp:CustomValidator>



Posted on Tuesday, December 29, 2009 3:25 PM | Back to top

Comments on this post: CustomValidator OnServerValidate not Firing

# CustomValidator OnServerValidate not Firing
Requesting Gravatar...
i have written a bellow code but not effect !!!
--------------------in source code--------------------------
<asp:CustomValidator ID="cvTransporterCode" runat="server" ControlToValidate="txtTransporterCode"
ErrorMessage="Transporter code already exists !!!" ForeColor="#CC0000"
OnServerValidate="cvTransporterCode_ServerValidate" SetFocusOnError="True" ValidationGroup="Trasporter"></asp:CustomValidator>

----------------------------code behind -------------------------
string result = Controller.transporter.checkTransporterCode(args.Value);
if (result.Contains("~9001"))
args.IsValid = true;
args.IsValid = false;

Left by vivek shimpi on Oct 13, 2016 11:48 AM

# re: CustomValidator OnServerValidate not Firing
Requesting Gravatar...
@vivek shimpi
If there's a question in your comment, it's not clear.
Left by angel eyes on Oct 13, 2016 2:52 PM

Your comment:
 (will show your gravatar)

Copyright © AngelEyes | Powered by: