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. Image for the cookie policy date

Fetch records based on pagesize and pagecount in Suncfusion grid

I have the requirement that while binding data to Syncfusion grid I want to load data based on pageSize and pageNumber. For e.g if pagesize is 10 and when user on 2nd page of grid then it will fetch the records from 11-20.I have written the stored procedure like only I am not able to pass startindex and pagecount to my controller action.Currently what happens that it initially fetch all the records from database because of that performance is very slow.

1 Reply

RU Ragavee U S Syncfusion Team April 25, 2016 07:30 AM UTC

Hi Pankaj, 

Thanks for your interest in Syncfusion products. 

We understand your requirement to load data based on the page size and current page in Grid. We can achieve this requirement using the “Load on Demand” technique of the ejDataManager. The details of the number of data to be retrieved will be obtained in skip and take parameters of the DataManager Class. Please refer to the following code example on how the data is filtered using the skip and take parameters of the DataManager Class 

public ActionResult Event(DataManager dm) 
            IEnumerable DataSource = OrderRepository.GetAllRecords(); 
            DataResult result = new DataResult(); 
            DataOperations operation = new DataOperations(); 
            result.result = DataSource;  
            result.count = result.result.AsQueryable().Count(); 
            if (dm.Skip > 0) 
                result.result = operation.PerformSkip(result.result, dm.Skip); 
            if (dm.Take > 0) 
                result.result = operation.PerformTake(result.result, dm.Take); 
            return Json(result, JsonRequestBehavior.AllowGet); 
Please refer the below screenshot: 

We have created a sample using URL Adaptor, which can be downloaded from the below location. 

Please refer to the below online documentation for more information on the adaptors. 

Ragavee U S. 

Live Chat Icon For mobile
Up arrow icon