I have a search form with DateTime search criteria, as well as some other criteria:
<form method="get" action="/app/search">
<input type="text" value="13/01/2010" name="BeginDate"/>
<input type="text" value="blah" name="SomeOtherCriterion"/>
<form>
So, I have a search controller with a default action (let it be called Index) and with the SearchCriteria parameter.
public class SearchController
{
public ActionResult Index(SearchCriteria searchCriteria) {
}
public class SearchCriteria
{
public DateTime BeginDate {get; set;}
public string SomeOtherCriterion {get; set;}
}
Now, if I want to create an ActionLink by passing the value of SearchCriteria, this way:
Html.ActionLink("Search", "Index", searchCriteria)
I get a BeginDate query string parameter in US format. Looking at Google and digging into System.Web.Routing using Reflector seems to be because it uses InvariantCulture, so there is nothing I can do about it.
It seems that no one has asked this question before, so I think I'm doing something very stupid .... Please help!
EDIT: SearchCriteria ActionLink, , , ToString().