Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > Window > custom validation using data annotations in model MVC3 | error messages not shown on client side though properties are added and jquery written

Not answered custom validation using data annotations in model MVC3 | error messages not shown on client side though properties are added and jquery written

Feed from this thread
  • Narayanarao avatar

    Posted on Dec 27, 2011 (permalink)

    Hi Team,

    I have implimented a custom validation using data annotation on model, MVC 3. Also imlimented jquery and scripts for unobstrusive client validation of the same, taken care to over ride the

    public override IEnumerable<ModelClientValidationRule> GetClientValidationRules()as well. but still error message and styling not shown for wrong values.

    I checked my scripts and the jquery, they are being registered (placed alerts in them to confirm).

    please help.

    Server side code below
    --DELETED--

    My model window code is as below
    --DELETED--
    The jquery scripts written for client validation is as below.
    --DELETED--

    thanks in advance
    Anand

    Reply

  • Daniel Daniel admin's avatar

    Posted on Dec 27, 2011 (permalink)

    Hi Narayanarao,

    I can think of a few possible issues that may be causing your troubles:

    1. jQuery hasn't been added before jquery.validate.
    2. jQuery and jquery.validate are added but the automatically added scripts by the Telerik ScriptRegistrar method aren't turned off.
    3. The attribute or the validator isn't registered in the Global.asax file.
    I attached a project that uses the same validator. Let me know if it works for you.

    All the best,
    Daniel
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now

    Reply

  • Narayanarao avatar

    Posted on Dec 30, 2011 (permalink)

    Hi Team,

    I have implimented all that you have suggested but it does not work.

    i notice the only difference being the version of jquery scripts which is old 1.4.* that you used in the solution provided. attaching my version of scripts. 

    please help.

    Thanks,
    Anand
    Attached files

    Reply

  • Daniel Daniel admin's avatar

    Posted on Dec 30, 2011 (permalink)

    Hi,

    Actually the jQuery version used in the project is 1.6.4(in the _Layout View). The 1.4.4 version is just the one added from the default template.
    Another problem with the validation may occur if you are using an earlier version of Internet Explorer with later version of jQuery(1.6.*). If this is the case you should get the latest version(1.9) of the jquery.validate library.


    Regards,
    Daniel
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now

    Reply

  • Narayanarao avatar

    Posted on Jan 2, 2012 (permalink)

    Hi,

    #1 >> I do not know why it does not work. Any other thoughts ?

    also I have one more query #2 >> , all validations in the Model window do not show if they are in partial view. 

    i tried adding 

    jQuery.validator.unobtrusive.parse('EditContactForm');
       Sys.Mvc.FormContext._Application_Load();

    to take care , but does not help. The same works if the model is in main .cshtml page.

    Reply

  • Georgi Tunev Georgi Tunev admin's avatar

    Posted on Jan 2, 2012 (permalink)

    Hi Narayanarao,

    To be able to help further, we will need a sample project that reproduces the case. Please send us such sample (or modify the one that Daniel sent you) and we will check it right away. 

    All the best,
    Georgi Tunev
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Telerik MVC Extensions (superseded) > Window > custom validation using data annotations in model MVC3 | error messages not shown on client side though properties are added and jquery written
Related resources for "custom validation using data annotations in model MVC3 | error messages not shown on client side though properties are added and jquery written"

ASP.NET MVC Window Features  |  Documentation  |  Demos  |  Telerik TV ]