Question

I have 3 steps, each step is its on view. On step 1 I ask for the start date/time(they can pick timezone and time) and store it as UTC, on step 3 I want to show the date/time based on the timezone they selected, without knowing which timezone they selected (don't store it, as users see it based on the computer timezone).

I want to know the best way to do this. I was thinking storing the tempdata, and then re-storing it. Though it doesn't seem like a best practice.

Was it helpful?

Solution

If the model(s) you use for steps 2 and 3 have a Timezone property, you could store the value in a hidden field and have it posted back to you, like this:

Html.HiddenFor(model => model.Timezone);

Alternatives would be putting the value in a cookie (and perhaps then using a CookieValueProvider to get it back) or putting it in session, although the last option isn't really how MVC is 'meant' to be used.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top