2

I am trying to localize datepicker and I can't fully understand where each code block should be.

In a view I have a script:

<script src="~/Scripts/jquery-1.10.2.js"></script>
<script src="~/Scripts/jquery-ui.js"></script>
<script type="text/javascript" src="https://raw.githubusercontent.com/jquery/jquery-ui/master/ui/i18n/datepicker-lv.js"></script>
<link href="~/Content/themes/custom/jquery-ui.css" rel="stylesheet" />

<script>
  $(function() {
    $('#datepicker').datepicker(
      $.datepicker.regional["lv"]
    );
  });
</script>

It has to be working with this text box in a same view:

<tr>
  <td align="left">@Html.LabelFor(m => m.TestDate)</td>
  <td align="left">@Html.TextBoxFor(m => m.TestDate, new { id = "datepicker", style = "width:200px"})</td>
</tr>

What is missing in that code?

ekad
  • 14,436
  • 26
  • 44
  • 46
GeekyNuns
  • 287
  • 2
  • 20

1 Answers1

2

I think "datepicker-lv.js" might not load and you are not aware of this. With the default settings on an ASP .NET MVC project you will get the following error :

You should try do download the datepicker-lv.js, include in your project as the others scripts file and load it from there.