The question seems to be basic but I would ask.
Is there a standard way to retain focus on the same field (where user was, before refresh) after page refresh in MVC3.
for simplicity purpose, I will take a simple scenario. scenario is like
I have three controls on a page.
- a textbox —Name
- a dropdown —Country)
- another dropdown—City (which loads cities from server based on the country selected in field 2 and this causes the page to refresh)
What I want,
the focus to be on Country field, after page refresh.
I hope, the question makes sense.
To achieve what you want, just use jQuery’s .focus function (http://api.jquery.com/focus/).
You may want to consider loading your dropdown dynamically through jQuery or jQuery UI so that you don’t get the page refresh.