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

How to process xml data from server using DataManager and bound to Grid

Problem

How to process the XML response from server and bound the result to Grid?

Solution

Essential Javascript DataManager works well with JSON data, but when comes with xml, we need custom adaptor to achieve this requirement. In the custom adaptor, the processResponse has to be overridden to process the xml response from the server.

In the below code snippet, we have extended processResponse method of the ej.UrlAdaptor and in the extended method, the xml data from the server is converted into JSON array. Now it can bound with grid. In the following code, we have performed simple Xml to Json conversion in the function “ConvertToJSON”, which will parse the simple xml document to json, for complex xml parsing, you can use external libraries.

 

 

Now let us see, how to use the above custom adaptor (named xmlAdaptor) in the grid. Render the grid and assign the custom adaptor to the grid datasource in the grid Load event.

Grid Initialization

JS

 

Razor:

 

 

 

Webforms:

 

 

Angular 2 with MVC backend

 

 

 

Asp.Net core:

 

 

Figure 1. Response from the server as XML

 

Figure 2. Grid with data from XML source

Article ID: Published Date: Last Revised Date: Platform: Control:
3377 01/23/2015 07/11/2018 ASP.NET MVC Grid
Did you find this information helpful?
Comments
Andrew Jang Aug 17, 2017

I think you've did not copy the very first line where you declare the function "GetXMLData".

What is its return type? Would you upload the signature of the function?

Reply
Add Comment
You must log in to leave a comment

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