Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everybody!

I seem to have a very common problem, about which I have Googled for many hours now, but could not find a solution...

My Custom-Validator in ASP.NET just won't work!
<asp:CustomValidator
    id="cusvalISBN"
    runat="server"
    ControlToValidate="txtISBN"
    Display="Dynamic"
    ErrorMessage="This ISBN already exists"
    OnServerValidate="isbnDuplication"
    ValidateEmptyText="True">
</asp:CustomValidator>


The function in my C# code is just NEVER being fired. I have tried debugging and everything, even "cusvalISBN.Validate()" does NOT call the function...

I am already using this validator in combination with a Requiredfieldvalidator. So empty text is not possible! The weird thing is: I already had the same problem a few days ago on another page... after some hours, it suddenly worked. I could reproduce the change I had done to make it working. The new code is just copied and pasted and yet, it isn't working :-(

Any ideas??
Posted
Updated 12-Mar-10 13:03pm
v4

Hi nishantsagar83!
Thank you very much for your answer!
Since I usually only use the sourcecode tab, i was really hoping this would do it... but it didn't:(
I mean, even when i click on the error text in design view, then my cursor jumps to the function for the Custom Validator, but it still is not called :-(
Is that a bug??
 
Share this answer
 
hi,

try switching to design view and then back to html view and code view...

sounds stupid.. but it does work sometime... thing's that sometimes the methods are not bound properly and switching between modes makes studio bind them again properly...

do let me know if u find some proper solution..

thnks..
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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