jQuery DatePicker plugin format date and ASP.NET MVC Get request
I have an asp.net mvc project with jQuery DatePicker controls. My page looks like this:
<% using (Html.BeginForm()开发者_JAVA百科)
{ %>
<%= Html.ValidationSummary(true) %>
....
<%= Html.TextBox("DateReport", Model.DateReport.ToShortDateString(), new { @class = "dateField" })%>
<input type="submit" value="Load report" />
<% } %>
<Code for my grid here>
<div class="pager">
<%= Html.PageLinks(Model.PagingInfo, x => Url.Action("List", "History", new { page = x, dateReport = Model.DateReport }))%>
</div>
Controller method:
public ActionResult List([DefaultValue(1)] int page, DateTime? dateReport)
{
...
return View(model);
}
When I first load the page, the datepicker's text box shows the correct date format: 30.01.2011.
When I change the date and submit "Load report" - the correct date is sent to the Controller and it returns the correct data for the report. The date in the datepicker textbox is also in the correct format: 30.01.2011.
But then I click on the link for the next page in the grid, I get returned a datepicker textbox date in an incorrect format, like this: 01/30/2011 00:00:00.
Please, help me - what I doing wrong!?
精彩评论