title: Should I always use a view model or is it ok to use ViewData?
body: <p>when do you think is it better to use ViewData over a view model?</p>
  
  <p>I have the same exact partial view in a couple of main views. I'd like to control how a partial view is rendered but I'd also prefer the partial view to accept only a view model which is a collection of records, just a pure <code>IEnumerable&lt;&gt;</code> object. I'd rather avoid to send the full view model object from a main view because it also contains a lot of different properties, objects, that control paging, sorting, filtering etc.</p>
  
  <p>Therefore the question is if I should create another view model for the partial view or is it ok to use ViewData? I've read soemwhere that using <code>ViewData</code> is a very bad practice.</p>
  
  <p>With View Data, I could simply pass require details like this:</p>
  
  <pre><code>@{
      ViewDataDictionary vd = new ViewDataDictionary
      {
          new KeyValuePair&lt;string,object&gt;("WithDelete", Model.WithDelete),
          new KeyValuePair&lt;string,object&gt;("WithRadarCode", Model.WithCode)
      };
  }
  
  // ...
  
  @if (Model != null) {
      Html.RenderPartial("_ListOfRecordingsToRender", Model.recordingViewModel, vd);
  }
  </code></pre>
  
  <p>At the moment, it would be sorted out.</p>
  
  <p>My worry is that currently this <code>*.recordingViewModel</code> has plenty of different variations in my project, because of different models for creating / editting,  listing, shoing details of a record etc. I feel like it may start to be too messy in my project if I make view model for each action.</p>
  
  <p>What do you think. Please could you advice on that particular problem. Thanks</p>