title: Alternative for ViewBag in MVC3
body: <p>I have a MVC3 web application where I need to implement a database search functionality. I am creating a ViewModel class for my search form so that I get the search parameters from View to controller. I can successfully get all my search parameters (which includes search query and check boxes if user wants to narrow search) in my controller class and retrieve data from database using repository pattern</p>
  
  <pre><code>var searchResult = _repository.GetItems(searchParms, chkbox1, chkbox2, ..., chkbox10)
  </code></pre>
  
  <p>After this, I am passing my searchResult to pagination helper like</p>
  
  <pre><code>var paginatedSearchResult = new PaginatedList&lt;Items&gt;(searchResult, page ?? 0, pageSize);
  </code></pre>
  
  <p>I am displaying the retrieved data in my view page </p>
  
  <pre><code>return View(paginatedSearchResult)
  </code></pre>
  
  <p>The problem, I am facing is, besides the data from the database, I also need to show the search query string and topic (for which checkbox was used) in my view page so that user can see what they searched for. I did not find any proper solution to this and had to use ViewBag. And now my Controller page looks ugly with more than 10 ViewBag. I know there must some good solution to this but I am not able to find it.Any suggestions will be highly appreciated.</p>
  
  <p>Thanks, 
  ACS</p>