variables not passing to route

Nov 1, 2012 at 11:01 PM
Edited Nov 1, 2012 at 11:41 PM

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

Coordinator
Nov 2, 2012 at 1: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 format...so ...

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)...se here for a list of standard date formats: 

http://msdn.microsoft.com/en-us/library/az4se3k1.aspx