Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET validation
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 Frown | :-(
 
Any ideas??
Posted 11-Mar-10 13:20pm
Edited 12-Mar-10 13:03pm
v4
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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'tFrown | :(
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 Frown | :-(
Is that a bug??
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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..
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 481
1 Maciej Los 345
2 OriginalGriff 308
3 Yogesh Kumar Tyagi 304
4 Prakriti Goyal 200
0 OriginalGriff 6,367
1 Sergey Alexandrovich Kryukov 5,296
2 Maciej Los 3,384
3 Peter Leow 3,259
4 DamithSL 2,490


Advertise | Privacy | Mobile
Web02 | 2.8.140721.1 | Last Updated 15 Mar 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100