Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 498833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T05:55:25+00:00 2026-05-13T05:55:25+00:00

I have an existing xml document with music playlist information, which is read into

  • 0

I have an existing xml document with music playlist information, which is read into a GridView control in Visual Basic. I am now wanting to save any updates in the GridView to that xml document. How can I do this?

Private Sub cboUsers_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cboUsers.SelectedIndexChanged
    Dim songList As New XmlDocument
    songList.LoadXml(s.GetPlaylist(cboUsers.SelectedItem.ToString()))
    Grid.Rows.Clear()
    Dim songs As XmlNodeList = songList.DocumentElement.SelectNodes("//Song")
    Dim song As XmlNode
    For Each song In songs
        Dim artist As String = song.SelectSingleNode("artist").InnerText
        Dim title As String = song.SelectSingleNode("title").InnerText
        Dim length As String = song.SelectSingleNode("length").InnerText
        Dim album As String = song.SelectSingleNode("album").InnerText
        Dim popularity As String = song.SelectSingleNode("popularity").InnerText
        Dim row() As Object = {artist, title, length, album, popularity}
        Grid.Rows.Add(row) ' Add as a row in the Grid
    Next
End Sub

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T05:55:26+00:00Added an answer on May 13, 2026 at 5:55 am

    One approach would be to add your own Update command column

    <asp:CommandField ShowEditButton="True" HeaderStyle-Width="80px" />
    

    Then use the grids Updating event to do your work. You can either retrieve the new (and old) values from the

    GridViewUpdateEventArgs e
    

    Eg

    String foo = e.NewValues["columnFoo"].ToString();
    

    Do your update to XML then cancel the update itself

     e.Cancel = true;
    

    C# code examples but easily copied to VB.

    Edit, added VB code as requested

    Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
    
        'Get some new values
        Dim foo As String = e.NewValues("fooColumn").ToString()
    
        'Im not sure how you plan to find the unique XML node so lets assume that your using title
    
        'So either get it from a datakey, if your using them in the gridview
        Dim titleFromDataKey As String = GridView1.DataKeys(e.RowIndex)("Title").ToString();
    
        'Or from the old values
        Dim titleFromOldValues = e.OldValues("Title").ToString()
    
        'Insert your logic to find the XML node and update it here
    
        'Cancel the update
        e.Cancel = True
    
    End Sub
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

TASK : I have an existing xml document (UTF-8) which uses xml namespaces and
I have an XML document of store locations which have a Type node indicating
I have to read a file (existing format not under my control) that contains
I have problem with generating and inserting xml in existing document. <table:table table:template-name=default> <table:table-column
I have several existing XML schema files with a defined data model. I would
I have an existing XML file that I would like to append without changing
Let's say I have an existing trivial XML file named 'MyData.xml' that contains the
I have existing Linux shared object file (shared library) which has been stripped. I
I have existing java code and need to create Design Document based on that.
I'm trying to add a processing instruction node to an existing XML document to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.