Open your mouth and prove it….

Shortly after writing that post on the ‘weird’ MVC decision I just figured out the reasoning behind the invariant culture for the other types of parameter.  The problem with the other types is that they come from url’s.  People tend to pass url’s around and you generally want them to work consistently no matter who’s loading them, wherever they are.  That explains their reasoning.

Now all I need to do is solve my problem.  I want the user to be able to enter a search date using their own date format and hit search and for that to be reflected in the url so that they can then bookmark the search.  Pretty simple, except that the form doesn’t see that text as a date, it sees it as text and doesn’t convert it to an invariant.

The only thing that I can think of is to store the culture the search was made with on the form so that it’s embedded into the url allowing me to have the best of both worlds.  Urls that are shareable and bookmarkable and pages that are aware of your local preferences for formatting.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s