我有 DatePicker 我能够选择 DatePicker 的值并且我被设置为 TextBox 但我无法进入模型它显示我为空。?
我的日期选择器在这里
@Html.TextBoxFor(model => model.CallDetailModel.CallDate, new { id = "callDate" })
我的 JavaScript 在这里
@section Scripts {
<script>
$("#callDate").datepicker({
changeMonth: true,
changeYear: true
});
</script>
}
我_Layout
在页脚关闭后和正文标签结束前添加了主题和 UI
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryui")
@Styles.Render("~/Content/themes/base/css")
@Scripts.Render("~/bundles/jquerymenu")
@RenderSection("scripts", required: false)
我的 CallDate 属性是这样的
public DateTime? CallDate { get; set; }
一旦我点击提交按钮,我就无法获得选定的日期值,它会显示空值。
我Create Action
的在这里
[HttpPost]
public ActionResult Create(CallModels model)
{
CallDetail obj = new CallDetail();
obj.AccompaniedBy = model.CallDetailModel.AccompaniedBy;
obj.BudgetFrom = model.CallDetailModel.BudgetFrom;
obj.BudgetTo = model.CallDetailModel.BudgetTo;
obj.CallCategory = model.CallDetailModel.CallCategory;
obj.CallDate = model.CallDetailModel.CallDate;
obj.CallDescription = model.CallDetailModel.CallDescription;
obj.CallDuration = model.CallDetailModel.CallDuration;
obj.CallTime = model.CallDetailModel.CallTime;
obj.CallType = model.CallDetailModel.CallType;
obj.ContactDetailId = model.CallDetailModel.ContactDetailId;
obj.Id = model.CallDetailModel.ContactDetailId;
obj.InquirySerialNo = model.CallDetailModel.InquirySerialNo;
obj.Priority = model.CallDetailModel.Priority;
obj.ProjectName = model.CallDetailModel.ProjectName;
obj.PropertySerialNo = model.CallDetailModel.PropertySerialNo;
obj.PurposeOfCall = model.CallDetailModel.PurposeOfCall;
obj.Reference = model.CallDetailModel.Reference;
obj.Reminder = model.CallDetailModel.Reminder;
obj.Result = model.CallDetailModel.Result;
obj.Tag = model.CallDetailModel.Tag;
obj.ContactDetail = null;
obj.IsActive = true;
if (ModelState.IsValid)
{
myChannelFactory = new ChannelFactory<IBuilderTrackerServices>(myBinding, myEndpoint);
// Create a channel.
IBuilderTrackerServices wcfClientProperty = myChannelFactory.CreateChannel();
var modelResult = wcfClientProperty.CreateCall(obj);
((IClientChannel)wcfClientProperty).Close();
if (modelResult)
return RedirectToAction("~/Views/CRM/Call/Index.cshtml");
}
return View(obj);
}
出了什么问题我不知道..?谢谢你。