Reputation: 9518
Good day!
I pass DateTime
value as route parameter and it became GET parameter in form like this:
http://example.com/?DateFrom=01%2F01%2F2011%2000%3A00%3A00&DateTo=01%2F31%2F2011%2000%3A00%3A00
For readability: this is an URL encoded from:
http://example.com/?DateFrom=01/01/2011 00:00:00&DateTo=01/31/2011 00:00:00
Is there any way to customize this serialization without using custom routes?
Thanks in advance!
Upvotes: 0
Views: 975
Reputation: 1038830
Instead of passing a DateTime you could pass a formatted string:
<%= Html.ActionLink(
"link text",
"someaction",
new {
DateFrom = Model.DateFrom.ToString("yyyy-MM-dd"),
DateTo = Model.DateTo.ToString("yyyy-MM-dd"),
}
) %>
Upvotes: 1