xml to gridview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tomlor1980
    New Member
    • May 2010
    • 2

    xml to gridview

    I'm trying to bind some XML data to a gridview.
    Obviously I'm not understanding how to do it properly because that my code doesn't seem to
    work...Can anyone could help me please?

    this is my xml:
    Code:
    #########################################
    <?xml version "1.0" encoding "utf-8"?>
    <dictionary>
      <item>
    	<key>
    	   <string> hello world </string>
    	</key>
    	<value> <anytype xmlns:q1="http://www.w3.org/2001/XMLSchame" d4p1:type="q1:int"
    	xmlns:d4p1="http-instance">45</anytype>
    	</value>
      </item>
    </dictionary>
    and this is my code:
    Code:
    ########################################
    string path = "D:\\myXmlFile.xml";
    DataSet oDs = new DataSet();
    oDs.ReadXml(path);
    GridView1.DataSource = oDs;
    GridView1.DataBind();
  • semomaniz
    Recognized Expert New Member
    • Oct 2007
    • 210

    #2
    you need to select the table of the dataset

    GridView!1.Data Source = oDs.Table[0];

    Comment

    Working...