Does the user have to "submit" the page for it to constitute the value being being persisted, or does the user simply have to select an option and then navigate to another page?
Anyway, you could just use the session storage. You can set this on a page submit (POST) or use some javascript Ajax to send the value on the change event of the drop down.
1. The POST way
(in your controller)
[HttpPost]
public ActionResult MyPage(PageData pageData)
{
Session["SelectedValue"] = pageData.MyDropDownValue;
}
2. The AJAX way (using JQuery)
(in your controller)
[HttpPost]
public ActionResult UpdateSession(string selectedValue)
{
Session["SelectedValue"] = selectedValue;
}
(in your javascript)
$(function () {
$("#MyDropDown").change(onChange);
};
function onChange(){
$.ajax({
url: 'MyController/UpdateSession',
type: 'POST',
dataType: 'json',
data: {selectedValue: $("#MyDropDown").val()},
contentType: 'application/json; charset=utf-8',
success: function(data){ },
error: function(err) { alert(err); }
});
}
then in the page you want to load the data you can access the session with...
<%= Session["SelectedValue"] %>
Or with the Razor View Engine in MVC 3 you could use the ViewBag instead...
(controller)
ViewBag.SelectedValue = "My Value";
(cshtml page)
@(ViewBag.SelectedValue)