I have DatePicker I am able to selecte the value of DatePicker and I was set to TextBox but I am not able to get into model it show me null.?
my date picker is here
@Html.TextBoxFor(model => model.CallDetailModel.CallDate, new { id = "callDate" })
my JavaScript here
@section Scripts {
<script>
$("#callDate").datepicker({
changeMonth: true,
changeYear: true
});
</script>
}
I have added theme and UI into _Layout
after closing of footer and before end of body tag
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryui")
@Styles.Render("~/Content/themes/base/css")
@Scripts.Render("~/bundles/jquerymenu")
@RenderSection("scripts", required: false)
my CallDate property like this
public DateTime? CallDate { get; set; }
once I click on submit button that time I am not able to get the selected value of date it show me null value.
My Create Action
is here
[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);
}
what is going to wrong I don't know..? thank you.