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
close icon

Grid Asp.Net Core Razor Page - Crud operation

Hi all,
I followed several examples on this forum on "how to use the grid with the razor page", but it doesn't work.
The test project is attached.
If I use the example using the datasource binding, the grid fills up,
If I use <e-data-manager> the events don't fired and the grid "no record to display"... how can I solve this problem?
Thank you

Attachment: testgridsyncfusion_82cf9f18.zip

5 Replies

HJ Hariharan J V Syncfusion Team July 9, 2019 01:41 PM UTC

Hi Aguzz, 

Greetings from the Syncfusion support,  

We have validated your query provided information and we have modified the sample with CRUD operation on EJ2 Grid in Razor. Please refer the below sample for more information. 


Regards, 
Hariharan 



AG Aguzz July 10, 2019 09:26 AM UTC

Hi, thanks for the quick answer.
I tested your example and now the Crud operation works well,
But I wanted to tell you, that if you enable allowSorting = "true" in your example it doesn't work

Thanks again

Hello


TS Thavasianand Sankaranarayanan Syncfusion Team July 11, 2019 10:20 AM UTC

Hi Aguzz, 

We have validated your query. While using remote data you need to handle the on demand actions in server side. Please find the below code snippet and sample for more information. 

Index.cshtml.cs 

public JsonResult OnPostDataSource([FromBody]DataManagerRequest dm) 
        { 
            IEnumerable DataSource = OrdersDetails.GetAllRecords(); 
            DataOperations operation = new DataOperations(); 
            if (dm.Search != null && dm.Search.Count > 0) 
            { 
                DataSource = operation.PerformSearching(DataSource, dm.Search);  //Search 
            } 
            if (dm.Sorted != null && dm.Sorted.Count > 0) //Sorting 
            { 
                DataSource = operation.PerformSorting(DataSource, dm.Sorted); 
            } 
            if (dm.Where != null && dm.Where.Count > 0) //Filtering 
            { 
                DataSource = operation.PerformFiltering(DataSource, dm.Where, dm.Where[0].Operator); 
            } 
            int count = DataSource.Cast<OrdersDetails>().Count(); 
            if (dm.Skip != 0) 
            { 
                DataSource = operation.PerformSkip(DataSource, dm.Skip);   //Paging 
            } 
            if (dm.Take != 0) 
            { 
                DataSource = operation.PerformTake(DataSource, dm.Take); 
            } 
            return dm.RequiresCounts ? new JsonResult(new { result = DataSource, count = count }) : new JsonResult(DataSource); 
    } 


Please get back to us, if you need further assistance. 

Regards, 
Thavasianand S. 



AG Aguzz July 11, 2019 12:14 PM UTC

Thank you, now works well.


HJ Hariharan J V Syncfusion Team July 12, 2019 09:35 AM UTC

Hi Aguzz, 
  
 We are happy to hear that your requirement has been achieved. 
  
Regards, 
Hariharan 


Loader.
Live Chat Icon For mobile
Up arrow icon