This question is locked. New answers and comments are not allowed.
I have a search page and i have two date pickers allowing the user to set a date range, and im having some trouble. I am using model binding, and i have this:
<div class="optionsCol1">
<%:Html.Label("Invoice Number:")%>
<%:Html.TextBoxFor(model => model.InvoicePartial)%>
<%:Html.Label("Company:")%>
<%:Html.DropDownListFor(model=> model.CompanyId, ViewData["CompanyBox"] as SelectList,new {id = "companyId"})%>
<%:Html.Label("From Date:")%>
<%:Html.Telerik().DatePickerFor(model => model.FromDate)
.Min(new DateTime(2010, 12, 01))
.Max(DateTime.Now)
.Value(Model.FromDate)%>
</div>
<div class="optionsCol2">
<br /><br /><br />
<%:Html.Label("Field Office:")%>
<%:Html.DropDownListFor(model => model.FieldOfficeId, ViewData["FieldOfficeBox"] as SelectList,new {id = "fieldOfficeId"})%>
<%:Html.Label("To Date:")%>
<%:Html.Telerik().DatePickerFor(model => model.FinalDate)
.Min(new DateTime(2010, 01, 01))
.Max(DateTime.Now)
.Value(Model.FinalDate)%>
</div>
Now, when i submit the form that they are on, the second date is not stored. It always comes back as 01/01/0001 and thus preventing the search. (By second one i mean model.FinalDate) Now, it does the same thing when im using a formcollection aswell. I am using the q3 build of the telerik mvc tools.
Is there any problem that it could be? Also, put the dates in, in reverse order it works. So if i assign final date, then from date, it works.
<div class="optionsCol1">
<%:Html.Label("Invoice Number:")%>
<%:Html.TextBoxFor(model => model.InvoicePartial)%>
<%:Html.Label("Company:")%>
<%:Html.DropDownListFor(model=> model.CompanyId, ViewData["CompanyBox"] as SelectList,new {id = "companyId"})%>
<%:Html.Label("From Date:")%>
<%:Html.Telerik().DatePickerFor(model => model.FromDate)
.Min(new DateTime(2010, 12, 01))
.Max(DateTime.Now)
.Value(Model.FromDate)%>
</div>
<div class="optionsCol2">
<br /><br /><br />
<%:Html.Label("Field Office:")%>
<%:Html.DropDownListFor(model => model.FieldOfficeId, ViewData["FieldOfficeBox"] as SelectList,new {id = "fieldOfficeId"})%>
<%:Html.Label("To Date:")%>
<%:Html.Telerik().DatePickerFor(model => model.FinalDate)
.Min(new DateTime(2010, 01, 01))
.Max(DateTime.Now)
.Value(Model.FinalDate)%>
</div>
Now, when i submit the form that they are on, the second date is not stored. It always comes back as 01/01/0001 and thus preventing the search. (By second one i mean model.FinalDate) Now, it does the same thing when im using a formcollection aswell. I am using the q3 build of the telerik mvc tools.
Is there any problem that it could be? Also, put the dates in, in reverse order it works. So if i assign final date, then from date, it works.