title: Maintaining input control state in MVC
body: <p>In the app I'm working on the administrator has the ability to select a customer to work with in a drop down list. Thing is that there are a large number of views that the administrator can go through and each time they'd have to select the customer again. In webforms this was rather easy... store it in a Session variable and reset it when another page loads. </p>
  
  <p>MVC not so much. I seem to be stuck at the point where I pass this value to the view from the controller. We are storing the value in a Session variable which we access using a base controller like this: </p>
  
  <pre><code>MyController.CurrentUser.CurrentCustomerId
  </code></pre>
  
  <p>The question I can't solve is how I pass this value to a partial view. The customer selector tool is in a partial view which is added to pages that need it. </p>
  
  <p>I thought of using the ViewBag, but that means that in every single action in my controllers that requires this value I would have to add: </p>
  
  <pre><code>ViewBag.CurrentCustomerId = CurrentUser.CurrentCustomerId; 
  </code></pre>
  
  <p>And even then I'm not sure if the ViewBag data is carried through to the partial view. I think it is. </p>
  
  <p>Seems like there should be a more efficient way to do this and still abide by MVC rules? </p>