title: How to Convert an IEnumerable model object to simple model object in view , MVC3
body: <p>I have to pass a model object to my create view , so that on submit click this model object gets updated.
  But at the same time iam using a list of data in its main Layout for rendering a dynamic menu.</p>
  
  <p>Both use the same model class. But for one i give as </p>
  
  <p><code>@model IEnumerable&lt;DynaPortalMVC.Models.Page&gt;</code></p>
  
  <p>and in the create view i give as</p>
  
  <p><code>@model DynaPortalMVC.Models.Page</code></p>
  
  <p>In Controller:-</p>
  
  <pre><code>public ActionResult Create()
      {           
          return View();
      } 
  </code></pre>
  
  <p>But this gives me an error in _Layout.cshtml, hence the above actionresult is not even executed.</p>
  
  <pre><code>Exception Details: System.ArgumentNullException: Value cannot be null.Parameter name: source
  </code></pre>
  
  <p>So i think i should pass the Ienumerable object to create view and then convert it there to simple model object, so that it can be updated. Please advice on this.</p>