title: ASP.NET MVC 5 - model value not getting passed correctly
body: <p>I am developing a Web Application in MVC 5 - also using Web API with Kendo UI Grid to display data.  When loading the grid of car data it is based on a customer id that will be set on the model.</p>
  
  <p>The markup for the Kendo UI Grid is in a Partial_View.</p>
  
  <p>So in my MVC controller I have something like below:</p>
  
  <pre><code>model.CustId = "12345"; //just hard coded - will possibly come from query string or set somewhere else
  return PartialView(_CarDetails, model);
  </code></pre>
  
  <p>Within my _CarDetails partial view the Kendo Grid code is as below.  I have also set a @Html.HiddenFor in the partial view for the CustId</p>
  
  <pre><code>@Html.HiddenFor(model =&gt; model.CustId)
  
                      //other setting up off Kendo UI Grid removed for Brevity
                        .DataSource(dataSource =&gt; dataSource
                            .Ajax()
                           .Read(read =&gt; read.Url("api/Car/GetDetails").Type(HttpVerbs.Get).Data("GetCustId"))
                        )
                        )
              &lt;/div&gt;
  </code></pre>
  
  <p>So on the Page which loads the Partial view in my Document.Ready I have a js fucntion which GetCustId - it is as below:</p>
  
  <pre><code>    function GetCustId() {
          alert('@Model.CustId');
          return { custId: '@Model.CustId' };
      }
  </code></pre>
  
  <p>alerting it returns blank and then if I seta breakpoint on my GetDetails method in webapi controller the custId field is null - if I hard code this to some value in my js function it gets passed fine but is there something incorrect in how I have wired it up to get the value from the model?</p>
  
  <p><strong>UPDATE</strong></p>
  
  <p>Web API method signature is as below:</p>
  
  <pre><code>   public DataSourceResult GetDetails([ModelBinder(typeof(ModelBinders.DataSourceRequestModelBinder))] DataSourceRequest request, string custId)
          {
              //this is another method in web api controller that calls services to get details and then maps the responses to View Model
              return GetCarDetailsByCustId(custId).ToDataSourceResult(request);
          }
  </code></pre>
  
  <p>Note I also updated the WebAPIconfig.cs file to inlucde {action} in the path as below:</p>
  
  <pre><code>      config.Routes.MapHttpRoute(
              name: "DefaultApi",
              routeTemplate: "api/{controller}/{action}/{id}",
              defaults: new { id = RouteParameter.Optional }
          );
  </code></pre>