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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Any sample on how to use the datamanager with asp.net core ?

Thread ID:

Created:

Updated:

Platform:

Replies:

144253 Apr 26,2019 07:18 PM UTC Jun 10,2019 06:20 PM UTC ASP.NET Core - EJ 2 4
loading
Tags: DataGrid
moez
Asked On April 26, 2019 07:18 PM UTC

I'd like to instantiate a data manger using taghelpers as follow:
<ejs-data id="dmanager" url="Assessments?handler=DataSource" adaptor="UrlAdaptor"></ejs-data>

The use it from javascript as usual :
var damanger = document.getElementById('dmanager').ej2_instances[0];

then call any methods that the data manager object might have (get data from server side handlers by sending queries, filtering, sorting...) and bind the results to my controls.

Is this possible ? Can you please provide any examples if it is ?

I'm using asp.net core with razor pages.

Thanks, M

Hariharan J V [Syncfusion]
Replied On April 29, 2019 09:28 AM UTC

Hi Moez, 

Thanks for contacting Syncfusion support. 

From your query we found that you need to provide the data source to Grid by using UrlAdaptor in razor page. We have prepared the Grid sample based on this requirement and you can find that sample from the below link, 

 
Also, please refer the following code snippet for further assistance, 
 
Grid: 
 
@Html.AntiForgeryToken() 
 
<ejs-grid id="Grid" allowPaging="true" load="onLoad" > 
    <e-grid-editsettings allowAdding="true" allowDeleting="true" allowEditing="true" mode="Batch"></e-grid-editsettings> 
    <e-data-manager url="/Index?handler=DataSource" batchUrl="/Index?handler=BatchUpdate" adaptor="UrlAdaptor"></e-data-manager> 
    <e-grid-columns> 
       <e-grid-column field="ShipCity" headerText="Ship City" textAlign="Right" width="120"></e-grid-column> 
    </e-grid-columns> 
</ejs-grid> 
 
<script> 
    function onLoad() { 
        this.dataSource.dataSource.headers = [{ 'XSRF-TOKEN': $("input:hidden[name='__RequestVerificationToken']").val() }]; 
    } 
</script> 
 
Controller: 
 
namespace Razorpages.Pages 
{ 
    public class IndexModel : PageModel 
    { 
        public static List<Orders> order = new List<Orders>(); 
        public void OnGet() 
        { 
            if (order.Count == 0) 
                BindDataSource(); 
        } 
        public class Data 
        { 
            public bool requiresCounts { get; set; } 
            public int skip { get; set; } 
 
            public int EmployeeID { get; set; } 
            public int EmployeeName { get; set; } 
            public int take { get; set; } 
        } 
 
        public JsonResult OnPostDataSource([FromBody]Data dm) 
        { 
            var data = order; 
            int count = data.Cast<Orders>().Count(); 
            return dm.requiresCounts ? new JsonResult(new { result = data.Skip(dm.skip).Take(dm.take), count = count }) : new JsonResult(data); 
        } 
   } 
} 

Regards, 
Hariharan 


moez
Replied On April 29, 2019 06:56 PM UTC

Hi Hariharan

Thank you for your response, but I was actually looking for examples demonstrating how to use the standalone Data Manager component (ejs-data tag).
I found examples on how to use the data manager in javascript, but not how to declaratively use the data manager in asp.net core.

Is that even doable ?

Thanks, Moez

Hariharan J V [Syncfusion]
Replied On April 30, 2019 12:52 PM UTC

Hi Moez,

Thanks for your update.

We have validated with our end and we have considered “Unable to use data manager tag helper as standalone” as a bug and logged a defect report for the same. We will include the defect fix in our upcoming May 15, 2019 patch release. 
 
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link. 
 
https://www.syncfusion.com/feedback/6088/unable-to-use-data-manager-tag-helper-as-standalone
 
Until then we appreciate your patience.  

Regards, 
Hariharan 



Pavithra Subramaniyam [Syncfusion]
Replied On June 10, 2019 06:20 PM UTC

Hi  moez, 

Thanks for your patience. 

We are glad to announce that  we have included the fix  for the issue “Unable to use data manager tag helper as standalone component” in our patch release (v17.1.48).  
 
Regards, 
Pavithra 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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

Live Chat Icon For mobile
Live Chat Icon