variables not passing to route

Nov 2, 2012 at 12:01 AM
Edited Nov 2, 2012 at 12:41 AM

I would like to do this:

<% var pagerBottom = Html.Pager(Model.CurrentPage, "currentPage", "ContractPaymentsReport", Model.TotalPages, "", "Reports", new { pageSize = Model.PageSize, RangeStart = Model.RangeStart, RangeEnd = Model.RangeEnd   }); %>

The pageSize = Model.PageSize works but I can't get the RangeStart and RangeEnd to work.  Is there anything I need to do to register these somewhere to get them to work?

FYI, I can enter &rangeStart=2010-03-01&rangeEnd=2012-01-01 on the url and it works.  As you can see RangeStart and RangeEnd are dates.

Thanks Rich

Nov 2, 2012 at 2:12 AM

Dates are problematic ....ALWAYS because the way they are serialized depends on the culture settings.  The default ToString for dates IS NOT the international ...

I advice to Apply ToString to your dates :

RangeStart= Model.RangeStart.Tostring("s"); 

shoud work...otherwise experiment with other international (that doesnt depend from the specific culture formats) here for a list of standard date formats: