title: call a partial view if and only if method call
body: <p>I have a partial view in _Layout page </p>
  
  <p>to bind values to that partial view I need to call specific method with some Ids, but this not default page loading method, and same _layout page use for this default view page</p>
  
  <p>but when this debug this application its going to initial load and saying that </p>
  
  <blockquote>
    <p>Object reference not set to an instance of an object.</p>
  </blockquote>
  
  <p>in Partial view page</p>
  
  <p>this is how I call to PartialView in _Layout page </p>
  
  <pre><code>Html.Partial("~/Views/Shared/_UserPartialView.cshtml", new Project.ViewModels.UserViewModel())
  </code></pre>
  
  <p>this is my PartialView</p>
  
  <pre><code>@model Project.ViewModels.UserViewModel
  
      @foreach (var item in Model.User)
      {
      }
  </code></pre>
  
  <p>how to avoid situation like this, call that partial view if and only if specific method call </p>