Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to retrive values into DataGridView From a XMLFile using c#.net2.0

How to retrive values into DataGridView From a XMLFile using c#.net2.0

Scheduled Pinned Locked Moved C#
csharptutorialxmlhelp
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pashitech
    wrote on last edited by
    #1

    HI, all i need help reg. datagridview of C# Windows Application. please guide me(if possible with a sample), how to get values from an xml in to Datagridview of C#.net2.0WINDOWS APp thnx in advance,

    prashanth, s/w Engineer, Syfnosys.

    N N C 3 Replies Last reply
    0
    • P pashitech

      HI, all i need help reg. datagridview of C# Windows Application. please guide me(if possible with a sample), how to get values from an xml in to Datagridview of C#.net2.0WINDOWS APp thnx in advance,

      prashanth, s/w Engineer, Syfnosys.

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      I am not sure But try creating one dataset and using datasets ReadXML method read the XML file you want. Set datasource as this dataset

      Cheers Navaneeth!! www.w3hearts.com

      1 Reply Last reply
      0
      • P pashitech

        HI, all i need help reg. datagridview of C# Windows Application. please guide me(if possible with a sample), how to get values from an xml in to Datagridview of C#.net2.0WINDOWS APp thnx in advance,

        prashanth, s/w Engineer, Syfnosys.

        N Offline
        N Offline
        nyogeswar
        wrote on last edited by
        #3

        Use this Sample............. I have used DataCaching also in it.......... private void Page_Load(object sender, System.EventArgs e) { if(Cache["1"]==null) { FileStream fs = new FileStream(Server.MapPath("simple.xml"),FileMode.Open,FileAccess.Read); CacheDependency cd=new CacheDependency(Server.MapPath("simple.xml")); DataSet ds=new DataSet(); ds.ReadXml(fs); DataView xmldata =new DataView(ds.Tables[0]); Cache["1"]=xmldata; Cache.Insert("1",xmldata,cd); } DataGrid1.DataSource=Cache["1"]; DataGrid1.DataBind(); // Put user code to initialize the page here } With Best Regards, Yogesh

        1 Reply Last reply
        0
        • P pashitech

          HI, all i need help reg. datagridview of C# Windows Application. please guide me(if possible with a sample), how to get values from an xml in to Datagridview of C#.net2.0WINDOWS APp thnx in advance,

          prashanth, s/w Engineer, Syfnosys.

          C Offline
          C Offline
          crzyank
          wrote on last edited by
          #4

          You may want to try this: private void cmdGetTrades_Click(object sender, EventArgs e) { dsXML.Clear(); // should already be defined else define it here // allowing user to select file else you can directly hard // code the file name openFileDialog1.Filter = "XML Files|*.xml"; openFileDialog1.Title = "Select SWAPs trades' XML file"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { dsXML.ReadXml(openFileDialog1.FileName); grdTrades.AutoGenerateColumns = true; grdTrades.DataSource = dsXML; grdTrades.DataMember = "trade"; grdTrades.Sort(grdTrades.Columns["TradeID"], ListSortDirection.Ascending); } } I am using this so it certainly works! Hope that helps you. crzYank

          P 1 Reply Last reply
          0
          • C crzyank

            You may want to try this: private void cmdGetTrades_Click(object sender, EventArgs e) { dsXML.Clear(); // should already be defined else define it here // allowing user to select file else you can directly hard // code the file name openFileDialog1.Filter = "XML Files|*.xml"; openFileDialog1.Title = "Select SWAPs trades' XML file"; if (openFileDialog1.ShowDialog() == DialogResult.OK) { dsXML.ReadXml(openFileDialog1.FileName); grdTrades.AutoGenerateColumns = true; grdTrades.DataSource = dsXML; grdTrades.DataMember = "trade"; grdTrades.Sort(grdTrades.Columns["TradeID"], ListSortDirection.Ascending); } } I am using this so it certainly works! Hope that helps you. crzYank

            P Offline
            P Offline
            pashitech
            wrote on last edited by
            #5

            thanx alot, can u tell me How to retrive images to the same datagridview --[here too my backend storage is XML] Thnx in advace

            prashanth, s/w Engineer, Syfnosys.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups