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. .NET (Core and Framework)
  4. XML view to display in grid view

XML view to display in grid view

Scheduled Pinned Locked Moved .NET (Core and Framework)
csssysadminwindows-adminxml
1 Posts 1 Posters 3 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.
  • M Offline
    M Offline
    Member_15925029
    wrote on last edited by
    #1

    ----The Sample XML File

    DEVSTUDIO Microsoft Windows Server 2008 R2 Standard

    ------------------ The above is my xml file, i am using dataset to populate in the gridview i am able to get the child node information but along with parent i am unable to do it. PFB the code Dim Opf As New OpenFileDialog() Opf.Filter = "XML File | *.xml" Opf.FileName = "" If Opf.ShowDialog() = DialogResult.OK Then Dim fcontent As String Dim fpath As String fpath = Opf.FileName Using sr As StreamReader = New StreamReader(fpath) DataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells DataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells DataGridView1.DefaultCellStyle.WrapMode = DataGridViewTriState.True fcontent = sr.ReadToEnd 'MsgBox(fcontent) Dim sfcontent As StringReader sfcontent = New StringReader(fcontent) Dim doc As XmlDocument = New XmlDocument() doc.Load(sfcontent) Dim naudit As XmlNode = doc.SelectSingleNode("/AuditResult/@name") Dim naudita = naudit.InnerText nlblaudit.Text = naudita Dim nauditc As XmlNode = doc.SelectSingleNode("/AuditResult/@created") Dim naudit1 = nauditc.InnerText Dim nauditb As XmlNode = doc.SelectSingleNode("/AuditResult/@type") Dim naudit2 = nauditb.InnerText nlblauditcreated.Text = naudit2 & " - Created" & " : " & naudit1 Dim ds As New DataSet() ds.ReadXml(New StringReader(fcontent)) DataGridView1.DataSource = ds.Tables(2) For i As Integer = 0 To Me.DataGridView1.Rows.Count - 1 If Not IsDBNull(Me.DataGridView1.Rows(i).Cells(2).Value) Then If Me.DataGridView1.Rows(i).Cells(2).Value = "Compliant" Then Me.DataGridView1.Rows(i).DefaultCellStyle.Ba

    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