I am trying to use the Kendo UI grid with serverPaging with Angular and ASP.NET MVC. Whenever I click "next page" in the grid, when it hits my Action Method, the request object is all zeros accept for Page which is ALWAYS = 1 so my paging never happens Here is my Angular code:
<code style=
"color: #000;"
>$scope.mainGridOptions = {<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> dataSource: {<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> transport: {<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> read: {<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> url:
'/SSQV4/SSQV5/Search/GetSearch'
,<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> type:
"GET"
<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> }<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> },<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> schema: {<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> data:
"results"
,<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> total:
"Total"
<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> },<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> pageSize: 25,<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> serverPaging:
true
<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>><</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> },<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> sortable:
true
,<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> pageable:
true
,<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> resizable:
true
,<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>><</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> columns: [{<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> field:
"CompanyID"
,<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> title:
"Company ID"
<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>><</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> }, {<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> field:
"CompanyName"
<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>><</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> }, {<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> field:
"City"
<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>><</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> }, {<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> field:
"State"
<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>><</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> }, {<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> field:
"Deficiencies"
<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> }]<</code><code style=
"color: #069;font-weight: bold;"
>br</code><code style=
"color: #000;"
>> };</code>
Here is my MVC Controller code:
public
async Task<ActionResult> GetSearch([DataSourceRequest(Prefix =
"Grid"
)] DataSourceRequest request)<br> {<br>
int
pageNum = request.Page;<br>
if
(request.PageSize == 0)<br> {<br> request.PageSize = 25;<br> } <br> MajorID = UserInfo.intMajorID;<br> var SearchString = System.Web.HttpContext.Current.Session[
"SearchString"
]
as
String ??
""
;<br> strSqlQuery =
" LEFT JOIN tblSSQReleaseToMajor RT (READUNCOMMITTED) ON C.CompanyID = RT.CompanyID and RT.MajorID = "
+ MajorID +
" LEFT JOIN tblTrainingRelease TR on C.CompanyID = TR.ContractorID"
;<br> <br> MajorID = UserInfo.intMajorID;<br>
string
preSqlQuery =
""
<br><br> var results = await SearchClient.PostReleasedSearch(preSqlQuery, strSqlQuery, 5000, 1);<br><br> var searchResults =
new
SearchResultsViewModel();<br> searchResults.Total = results.Count();<br>
if
(request.Page > 0)<br> {<br> results = results.Skip((request.Page - 1) * request.PageSize).ToList();<br> }<br> results = results.Take(request.PageSize).ToList();<br><br> searchResults.results = results;<br><br>
return
Json(searchResults, JsonRequestBehavior.AllowGet);<br><br> }
What am I missing here?