Set Locale property

Yesterday I installed the latest version of jQuery 3.2.1 and syncfusion 15.4.0.17. Everything went fine through the migration of the project to the latest version.
I the previous version, I created this script



files for my language and it was working fine.

Now, I have this kind of problem: every time I select the date in the datepicker control, I get the message






I the _Layout view I have



There must be something I missing:

Thanks.

7 Replies

BC Berly Christopher Syncfusion Team November 17, 2017 01:39 PM UTC

Hi Bernard, 
  
Thanks for contacting Syncfusion support. 
  
We have looked into your query on “Every time I select the date in the datepicker control, I get the message” and we suspect that root cause of this issue is due to DateFormat set based on the globally specified culture (by default “en-US”) after the postback. Hence, date value becomes invalid for dateFormat(“d.M.yyyy.”) of the specified locale(“hr-HR”). So, we are suggesting to try the below code example to get rid of the reported issue. 
Global.asax.cs: 
protected void Application_BeginRequest(Object sender, EventArgs e) 
        { 
            CultureInfo newCulture = (CultureInfo)System.Threading.Thread.CurrentThread.CurrentCulture.Clone(); 
            newCulture.DateTimeFormat.ShortDatePattern = "d.M.yyyy."; 
            newCulture.DateTimeFormat.DateSeparator = "."; 
            Thread.CurrentThread.CurrentCulture = newCulture; 
        } 
 
 
 
For your convenience, we have prepared the sample based on your requirement. Please get the sample from the below location. 
  
If still you are facing problem please revert us with issue reproducing sample or code example that will help us to provide solution.  
  
Regards, 
Berly B.C 



BJ Bernard Jurlina November 17, 2017 07:03 PM UTC

Hi Christopher,

and thanks for the answer. Unfortunately, after adding your piece of code in the Global.asax, I stil get the validation message.
The thing is that the validation is running in the modal window, so in the index view I had to add



for the validation to work. If I remove the code in the red border, the validation message is not shown.
But this was ok and it was working fine before I updated to the latest version 15.4.0.17.

I have the latest versions of this validation scripts



Regards,
Bernard.


BJ Bernard Jurlina November 18, 2017 03:30 PM UTC

I tried to use latest version of the working project, and just upgrade EJ controls to the latest version. Still, it does not working.
In the attached zip are my _Layout.cshtml, Index view, Partial view _CreateEdit and the controller for the views.

Maybe this will help to help. 
Thanks!

Bernard.


Attachment: EJ_e4091c0.zip


BJ Bernard Jurlina November 19, 2017 11:07 AM UTC

Here is the complete solution in the attached zip file.
Partial view in moadl is opening from the Home/Index view on the button click.

Anyway, as soon I enable this piece of code.



I get the message to enter valid date in DatePicker. I have to use this jQuery.validator.unobtrusive.parse because the validation over data annotations in the modal won't work. Without this, the message for valid date will not appear, but then I can post model without required fields.

Thank you.

Regards,
Bernard.

Attachment: SyncfusionMvcApplication1_84dc8c12.zip


BC Berly Christopher Syncfusion Team November 20, 2017 01:00 PM UTC

Hi Bernard, 
 
Thanks for the update.  
 
We have checked with your provided sample. We suspect that root cause of this issue is due to DateFormat set based on the globally specified culture (by default “en-US”). If you want to use different dateFormat with jQuery validation, we are suggesting to try the below code example in your application to get rid of the reported issue (“Every time I select the date in the datepicker control, I get the message”). 
 
//to validate the different format 
[index.cshtml] 
 
<script> 
    jQuery.validator.methods["date"] = function (value, element) { 
        return true; 
    } 
</script> 

  
We have modified the provided sample and get the sample from the below location. 
 
 
Regards, 
Berly B.C 



BJ Bernard Jurlina November 20, 2017 05:59 PM UTC

Hi Christopher,

and thanks for the solution. Everything is working fine now.

Regards,
Bernard.


BC Berly Christopher Syncfusion Team November 21, 2017 06:49 AM UTC

Hi Bernard, 
 
Thanks for the update. 
 
We are glad to hear that the reported issue is resolved at your end. Please, let us know if you need any further assistance. We will be happy to help you. 
 
Regards, 
Berly B.C 


Loader.
Up arrow icon