locked
hello, i'm question RRS feed

  • Question

  • User256534580 posted

    how to read a file xml into datagrid in window mobile

     

    thanks

    Monday, March 28, 2011 11:55 PM

Answers

All replies

  • User1943143334 posted

    Hi,

    Check the below links.

    http://www.dotnetheaven.com/UploadFile/prathore/DataGridView09122007013411AM/DataGridView.aspx

    http://www.geekpedia.com/tutorial107_Binding-a-DataGrid-to-an-XML-file.html

    The above links r the best resources for binding XML files to DataGrid.

    Hope it helps u...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, March 29, 2011 12:19 PM
  • User-1528094326 posted

    Use XPath in the System.Xml namespace with windows mobile.

    Typically on windows mobile, files are locaed in the \Program Files\<Application Name>\XmlFileHere.xml

    So in your code behind just do something like...

    private string FileLocation = @"\Program Files\MyApplication\XmlFile.xml";
    
    XmlDocument xmlFile = new XmlDocument();
    xmlFile.Load(FileLocation);
    
    XmlNodeList nodes = xmlFile.SelectNodes("Root/NodesYouWant");
    
    foreach (XmlNode node in nodes)
    {
       // do something here...
    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, March 29, 2011 12:22 PM
  • User621942214 posted

    use this code to do so..

    private string strXMLFile = @"\path\fileName.xml";
    
    XmlDocument xmlFile = new XmlDocument();
    xmlFile.Load(strXMLFile);
    
    XmlNodeList nodes = xmlFile.SelectNodes("RootNode/YourChoiseNode");
    
    foreach (XmlNode node in nodes)
    {
       // your DataGrid Binding Code
    }

    Thursday, May 26, 2011 7:25 AM