Error in DatePicker JQueryUI in View

0

In my .Net MVC project, I can not get a JavaScript result that is in 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>  
    
asked by anonymous 06.02.2015 / 17:22

1 answer

1

Hans Miller, I advise you not to try to manipulate the ID, in spite of this 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><scriptsrc="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)
    
06.02.2015 / 17:43