We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Paginacion

Thread ID:

Created:

Updated:

Platform:

Replies:

127695 Dec 2,2016 08:26 PM UTC Dec 5,2016 01:47 PM UTC ASP.NET MVC 1
loading
Tags: Grid
Juan Lobos
Asked On December 2, 2016 08:26 PM UTC

Hola:

Como puedo realizar la paginacion en el controlador, para enviar los datos paginados a la vista, hay alguna forma de hacerlo, ya que todos los ejemplos que he visto realizan la paginacion en el lado de la vista o del cliente.

De antemano muchas gracias.
Atte.

Seeni Sakthi Kumar Seeni Raj [Syncfusion]
Replied On December 5, 2016 01:47 PM UTC

Hi Juan, 
 
We suspect that would like to handle server-side paging. This can be achieved using the URLAdaptor (of DataManager) which will be assigned as DataSource to the Grid. URLAdaptor manages the server actions which sends the POST requesting the data DataManager queries. So we can retrieve the required number of data and populate the same in Grid. DataManager also provides the Server-Side APIs to handle the Paging action in the server. AllowPaging must be enabled in the Grid to perform paging action in the server-end. Refer to the following code example. 
 
@(Html.EJ().Grid<MvcApplication66.OrdersView>("FlatGrid") 
        .Datasource(ds => 
            ds.URL("/Home/DataSource") 
            .Adaptor(AdaptorType.UrlAdaptor)) 
        .AllowPaging() 
             . . . 
                 . ..  
) 
 
        public ActionResult DataSource(Syncfusion.JavaScript.DataManager dm) 
        { 
            IEnumerable DataSource = new NorthwindDataContext().OrdersViews.ToList(); 
            DataOperations ds = new DataOperations(); 
            DataResult result = new DataResult(); 
            result.count = DataSource.AsQueryable().Count();//count 
            if (dm.Skip != null) 
                DataSource = ds.PerformSkip(DataSource, dm.Skip); 
            if (dm.Take != null) 
                DataSource = ds.PerformTake(DataSource, dm.Take); 
            result.result = DataSource; //resultant data 
            return Json(result, JsonRequestBehavior.AllowGet); 
        } 
 
Note: ReturnType of the READ (URL) Method must be result/count pair.  
 
Refer to the following Help Document. 
 
 
Likewise, we can perform other Grid actions like Filtering, Sorting in the Server-end. Refer to the following KB for the Server-side APIs DataManager. 
 
 
We have also prepared a sample that can be downloaded from the following location. 
 
 
Regards, 
Seeni Sakthi Kumar S. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;