This is a migrated thread and some comments may be shown as answers.

Generic Xml Viewer

3 Answers 380 Views
Grid
This is a migrated thread and some comments may be shown as answers.
ADe
Top achievements
Rank 1
ADe asked on 16 Feb 2009, 03:46 PM
Is it possible to load an Xml file into a RadGrid for web display purposes. I tried loading an xml file into a DataSet and assigning that to a RadGrid's DataSource but it only displays one level.

I will not know what the content of the xml files will be so can't specifically add fields to the grid ect.

Is this possible?

3 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 19 Feb 2009, 08:47 AM
Hello ADe,

To see more information along the lines of the requested functionality, please refer to the following example. I hope it gets you started properly.

Kind regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Fazal
Top achievements
Rank 1
answered on 28 Feb 2013, 12:10 AM
I have not tested/implemented it but wondering how grid will look like if the data is jagged and not a straight grid. Any idea?

Abbas
0
Radoslav
Telerik team
answered on 04 Mar 2013, 03:40 PM
Hi Fazal,

The RadGrid only binds to flat XML structures out of the box. If you have more complex (hierarchical) XML, you will have to manually load the XML in DataSet or try the approach demonstrated in our RSS binding demo here:
RSS binding

Additionally if you want to show the hierarchical xml in hierarchical RadGrid you could try binding the RadGrid to data programmatically into NeedDataSource and DetailTableDataBind events. On the following link you could find online example of programmatic binding:
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/detailtabledatabind/defaultcs.aspx
On NeedDataSource event you could read your top level nodes of the xml and into DetailTableDataBoud you could try getting the sublevel nodes.
Also please check out the following links:
http://support.microsoft.com/kb/307548
http://onjava.com/pub/a/onjava/2005/01/12/xpath.html
http://www.stardeveloper.com/articles/display.html?article=2009031001&page=1
http://msdn.microsoft.com/en-us/magazine/cc164116.aspx
http://www.codedigest.com/Articles/ASPNET/342_Using_XPath_Expression_to_Access_or_Read_XML_document_in_ASPNet.aspx

I hope this helps.

Kind regards,
Radoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
ADe
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Fazal
Top achievements
Rank 1
Radoslav
Telerik team
Share this question
or