Hi There;
My code is as follows:
public class Kisi
{
[Display(Name="date1")]
public DateTime date1{ get; set; }
[Display(Name = "date2")]
public DateTime date2 { get; set; }
[Display(Name = "date3")]
public DateTime date3{ get; set; }
}
here is my view:
//most parts ommited for brevity
@model LojmanMVC.Domain.Kisi
@{
ViewBag.Title = "KisiOlustur2";
}
<h2>KisiOlustur2</h2>
@using (Html.BeginForm()) {
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<fieldset>
<!-- date1-->
<div>
<div class="editor-label">
<label>date1? </label>
</div>
<div class="editor-field">
@(Html.Kendo().DatePickerFor(m=>m.date1)
.Name("dtpickerMemuriyetBaslama")
.Min(new DateTime(1900, 1, 1))
.Max(new DateTime(2099, 12, 31))
.Value(DateTime.Today)
)
<br />
<!-- Html.ValidationMessageFor(model => model.MemuriyetBaslamaTarihi)-->
</div>
</div>
<div id="tey" style="display:none">
<div class="editor-label">
@Html.LabelFor(model => model.date2)
</div>
<div class="editor-field">
@(Html.Kendo().DatePickerFor(m=>m.date2)
.Name("dtAskerlikBaslama")
.Min(new DateTime(1900, 1, 1))
.Max(new DateTime(2099, 12, 31))
.Value(DateTime.Today)
)
@Html.ValidationMessageFor(model => model.AskerlikBaslangicTarihi)
</div>
</div>
<div id="hey" style="display:none">
<div class="editor-label">
@Html.LabelFor(model => model.date3)
</div>
<div class="editor-field">
@(Html.Kendo().DatePickerFor(m=>m.AskerlikBitisTarihi)
.Name("dtAskerlikBitis")
.Min(new DateTime(1900, 1, 1))
.Max(new DateTime(2099, 12, 31))
.Value(DateTime.Today)
)
</div>
</div>
Here is my _Layout.cshtml:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
<link href="/Content/Site.css" type="text/css" rel="stylesheet" />
<link href="/Scripts/jquery-ui.css" rel="stylesheet" />
<link href="~/Scripts/MenuStyle.css" rel="stylesheet" />
<link href="~/Scripts/jquery-ui.css" rel="stylesheet" />
<link href="@Url.Content("~/Content/kendo/2016.1.112/kendo.common.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2016.1.112/kendo.mobile.all.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2016.1.112/kendo.dataviz.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2016.1.112/kendo.default.min.css")" rel="stylesheet" type="text/css" />
<link href="@Url.Content("~/Content/kendo/2016.1.112/kendo.dataviz.default.min.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/kendo/2016.1.112/jquery.min.js")"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="/Scripts/jquery-ui-1.11.4.min.js"></script>
<script src="~/Scripts/jquery-ui.js"></script>
<script src="~/Scripts/jquery-ui.min.js"></script>
<script src="@Url.Content("~/Scripts/kendo/2016.1.112/jszip.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/2016.1.112/kendo.all.min.js")"></script>
<script src="@Url.Content("~/Scripts/kendo/2016.1.112/kendo.aspnetmvc.min.js")"></script>
<script src="~/Scripts/kendo/2016.1.112/cultures/kendo.culture.tr-TR.min.js"></script>
<script>
kendo.culture("tr-TR");
</script>
</head>
<body>
<div id="header">
<div class="title">Lojman Bilgi Sistemi</div>
</div>
<div id="categories">
@{ Html.RenderAction("Menu", "Nav"); }
</div>
<div id="content">
@RenderBody()
</div>
</body>
</html>
The problem is that model's date1 date2 and date3 is null even though I pick date. How can I solve it?
Thanks in advance.