Just need
@Html.Pager(8, 1, (int)ViewBag.totalCount)
assuming it is int (you need to specify that it will be dynamic ). There is no @ before the ViewBag (since you are already in the code), and if the pager returns a non-void, you can omit the final one ;
source share