BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Hi Thomas,
Thanks for your interest in Syncfusion products.
We would like to let you know that your requirement
to perform custom paging in web service data binding has been achieved. Please,
refer the below code snippets to achieve your requirement.
Code
Snippets:
[CSHTML]
@(Html.Syncfusion().Grid<WebServiceBinding.Models.Order>("WebServiceBinding")
.WebService("/Models/Orders.asmx/RenderOrders")
...
.TotalRecordCount(100)
)
[CS]
[WebMethod]
public GridWebService RenderOrders(WebServiceParams webParams)
{
WebParams
requestparams = new JavaScriptSerializer().Deserialize<WebParams>(webParams.GridRequestParams);
RequestType requesttype = (RequestType)Convert.ToInt32(requestparams.RequestType);
if (requesttype == RequestType.Paging)
{
IEnumerable pagingdata = OrderDetails(requestparams.StartIndex,
requestparams.PageSize);
return
pagingdata.GridWebServiceAction<Order>(webParams,
totalrecordcount);
}
else
{
IEnumerable data = new NorthwindDataContext().OrdersViews.Take(100).ToList();
return
data.GridWebServiceAction<Order>(webParams, totalrecordcount);
}
}
private IEnumerable OrderDetails(int Index, int pagesize)
{
int PageSize = pagesize == 0 ? 8
: Convert.ToInt32(pagesize);
IEnumerable data = new NorthwindDataContext().OrdersViews.Skip(Index).Take(PageSize).ToList();
return
data;
}
public class WebParams
{
public int RequestType { get; set; }
public int StartIndex { get; set; }
public int PageSize { get; set; }
public string GridID { get; set; }
public string Skin { get; set; }
public string IsGrouped { get; set; }
}
For your convenience we have created a
sample depicting your requirement and the same can be download from the below
link,
Sample Link:
http://www.syncfusion.com/downloads/support/directtrac/119602/WebServiceBinding473474074.zip
Please let us know if you need any
further assistance.
Regards,
Prabhu Sarvesan