title: jQuery Bootgrid - Ajax Sort Parameter with ASP.NET MVC Actions
body: <p>I managed to create an ApiController retrieving data from my repositories, and populating a grid in my view through <strong>Bootgrid with Ajax</strong>. This is an example of request data sent to Api's Action, given by <a href="http://www.jquery-bootgrid.com/Examples#command-buttons" rel="nofollow">their Docs here</a> (look for POST Body Request tab):</p>
  
  <pre><code>current=1&amp;rowCount=10&amp;sort[sender]=asc&amp;searchPhrase=&amp;id=b0df282a-0d67-40e5-8558-c9e93b7befed
  </code></pre>
  
  <p>Here is an example URL:</p>
  
  <pre><code>http://localhost/api/SomeController?current=1&amp;rowCount=10&amp;sort%5BName%5D=asc&amp;searchPhrase=&amp;id=b0df282a-0d67-40e5-8558-c9e93b7befed
  </code></pre>
  
  <p>I created two Helper classes to handle data I must return as response, and sort data (as it's an array):</p>
  
  <pre><code>public class SortData
  {
      public string Field { get; set; } // FIeld Name
      public string Type { get; set; } // ASC or DESC
  }
  
  public class BootgridResponseData&lt;T&gt; where T: class
  {
      public int current { get; set; } // current page
      public int rowCount { get; set; } // rows per page
      public IEnumerable&lt;T&gt; rows { get; set; } // items
      public int total { get; set; } // total rows for whole query
  }
  </code></pre>
  
  <p>Therefore, my action is as follow:</p>
  
  <pre><code>    public BootgridResponseData&lt;SomeViewModel&gt; Get(int current, int rowCount, List&lt;SortData&gt; sort, string searchPhrase, string id)
      {
         // get items and return a bootgrid response data with them...
      }
  </code></pre>
  
  <p>The method is invoked and all parameters come with data properly, except sort, which is always null.</p>
  
  <p>What kind of parameter should I expect for this? I also tried to put <code>object</code> but it comes null anyway.</p>