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.

Putting header in DataManager

Thread ID:

Created:

Updated:

Platform:

Replies:

128473 Jan 25,2017 02:53 AM Jan 31,2017 06:05 AM Angular 3
loading
Tags: ejDatamanager
Dina Abdelbary
Asked On January 25, 2017 02:53 AM


Hi,

I m using an api service method to get the datasource for an ejGrid to do virtual scrolling

"getReportData() {
    this.gridData = new ej.DataManager({
      url: 'http://localhost:43317/api/WebReports/GetReportData/'+ this.reportId,
      adaptor: new ej.UrlAdaptor()
      ,crossDomain: true
    });"

" public IEnumerable<dynamic> GetReportData( int id, DataManager dm)
        {
               ...
               return res;
        }"
and i m putting "[EnableCors(origins: "http://localhost:3000", headers: "*", methods: "*")]" above the controller to enable cors.

but this error appears

"XMLHttpRequest cannot load http://localhost:43317/api/WebReports/GetReportData/61. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. The response had HTTP status code 405."

i think the solution is putting a header at the request of the datamanager, but i don't know how.

Please advise.


Karthikeyan Viswanathan [Syncfusion]
Replied On January 26, 2017 12:07 PM

 
Hi Dina Abdelbary, 
 
Thanks for contacting Syncfusion support. 
 
We analyzed the code examples that you have shared. If you would like to fetch data from a custom action of controller, then we suggest you to use without localhost URL of the DataManager.  
 
Please refer to the below online documentation in which we have explained in detail on the various data binding concepts help link: https://help.syncfusion.com/js/datamanager/data-adaptors#url-adaptor  
 
We have prepared a grid sample with URL adaptor binding, which can be downloaded from the below location.  


Regards,  
Karthikeyan V. 
 


Dina Abdelbary
Replied On January 29, 2017 05:27 AM

Hi,

The demo you have attached uses jquery not angular2 !! and also my question uses web api service, and the attached one uses a normal Controller not ApiController,
what do you mean about "use without localhost URL of the DataManager", so what if i wanna call a web api service method??
and also i asked about how to set the header at the request of the datamanager

Regards,

Prince Oliver [Syncfusion]
Replied On January 31, 2017 06:05 AM

Hi Dina, 

Thanks for using Syncfusion products. 
We have created a new incident under your account. We suggest you to follow up the incident for further reference using your direct trac account.  
Please let us know if you have any concerns. 

Regards, 
Prince 


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.

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.

;