Datepicker Jqueryui error in View

Asked

Viewed 129 times

0

In my project . Net MVC, I can’t get results on the Javascript view

 @using Forte.Rastreador.ViewModels

 @model SuperViewModel
 <script src="~/Scripts/jquery-ui-1.8.24.min.js"></script>
   <script type="text/javascript">
   $(function () {
     $("#datepicker").datepicker();
   });
 </script>

<fieldset>
  <legend>Pessoa Física:</legend>
  @Html.Label("CPF: ")
  @Html.TextBoxFor(m => m.CPFPessoa, new { maxlength = "11" })
  <br />
  @Html.Label("N° de Identidade: ")
  @Html.TextBoxFor(m => m.RGPessoa)
  <br />
  @Html.Label("Data de Nascimento: ")
  @Html.TextBoxFor(m => m.DataNascimento, new { id = "datepicker"})
  <br />
  @Html.Label("Sexo: ")
  @Html.DropDownListFor(m => m.Sexo, Model.GeneroList)
  <br />
  @Html.Label("Estado Civil: ")
  @Html.DropDownListFor(m => m.EstadoCivil, Model.EstadosCivisList)
</fieldset>  

1 answer

1

Hans Miller, I advise you not to try to manipulate the ID, in Vex try to use a date attribute.

@using Forte.Rastreador.ViewModels

@model SuperViewModel
<link href="https://code.jquery.com/ui/1.11.2/themes/flick/jquery-ui.css" rel="stylesheet" />
<script src="https://code.jquery.com/jquery-2.1.3.js"></script>
<script src="https://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script type="text/javascript">
  $(function () {
    $("[data-datepicker]").datepicker();
  });
</script>

<fieldset>
<legend>Pessoa Física:</legend>
@Html.Label("CPF: ")
@Html.TextBoxFor(m => m.CPFPessoa, new { maxlength = "11" })
<br />
@Html.Label("N° de Identidade: ")
@Html.TextBoxFor(m => m.RGPessoa)
<br />
@Html.Label("Data de Nascimento: ")
@Html.TextBoxFor(m => m.DataNascimento, new { @data_datepicker = "" })
<br />
@Html.Label("Sexo: ")
@Html.DropDownListFor(m => m.Sexo, Model.GeneroList)
<br />
@Html.Label("Estado Civil: ")
@Html.DropDownListFor(m => m.EstadoCivil, Model.EstadosCivisList)
  • not tah working !! tried the same way you posted but did not get result

  • I’m not seeing the jquery script or jquery ui css, in any case I changed the example for jQuery and jQueryUI CDN.

  • the scripts are these?? <link href="~/Scripts/jquery-ui-1.11. 2/jquery-ui.css" rel="stylesheet" /> <script src="~/Scripts/jquery-ui-1.11. 2/External/jquery/jquery.js"></script> <script src="~/Scripts/jquery-ui-1.11. 2/jquery-ui.js"></script> The order is Correct?

  • Thanks partner was missing the scripts!!! I got success!!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.