Edit this page

Bind to XML

Binding to XML is not *directly *supported but DataTables are supported and a DataSet (containing DataTables) can be created from an XML document.

This is a simple xml file used in the examples below:

    <?xml version="1.0" encoding="utf-8"?>
        <name> John </name>
        <age> 30</age>
        <name> Sarah </name>
        <age> 45</age>
        <name> Tom</name>
        <age> 50 </age>

gridview-populating-with-data-bind-to-xml 001

You have to create a DataSet instance from the XML file. For the sample XML file above, the created DataSet contains only one DataTable which is set as RadGridView data source. Please refer to this topic if you want to create hierarchy.

DataSet xmlDataSet = new DataSet();
this.radGridView1.DataSource = xmlDataSet.Tables[0];

Dim xmlDataSet As New DataSet()
Me.RadGridView1.DataSource = xmlDataSet.Tables(0)

See Also

Was this article helpful? Yes No
Thank you for your feedback!

Give article feedback

Tell us how we can improve this article