вы должны использовать
@Html.TextBoxFor(model=>model.text1, new {@class="date-picker"});
<script>
$(".date-picker").datepicker();
</script>
OR
1 - Добавить новый редактор в Views-> Shared-> EditorTemplates DateTime
@model System.DateTime?
@if (Model.HasValue)
{
@Html.TextBox("", Model.Value.Date.ToShortDateString(), new { data_datepicker = "true", style="width:80px;" })
}
else
{
@Html.TextBox("", null, new { data_datepicker = "true", style="width:80px;" })
}
<script type='text/javascript'>
$(function () {
$(":input[data-datepicker]").datepicker({
showOtherMonths: true,
selectOtherMonths: true,
showOn: "both",
showAnim: "slide",
showButtonPanel: true,
changeMonth: true,
changeYear: true,
numberOfMonths: 2,
buttonImage: "@Url.Content("~/xtras/images/calendar.png")",
buttonImageOnly: true
});
};
</script>
2 - использовать EditorFor помощник для просмотра
@Html.EditorFor(model=>model.date1)