Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 664
  • Last Modified:

Updating xmldatasource from gridview

I have a gridview which is populated from an xmldatasource, "xmlSegments" (from an .xml file in App_Data).

Here's the bit out of the .aspx file:
 
        <asp:GridView ID="GridView1" runat="server" DataSourceID="XmlSegments"
            AutoGenerateEditButton="True"  >
          </asp:GridView>

  <asp:XmlDataSource ID="XmlSegments" runat="server"
        datafile="App_Data/Segments.xml"></asp:XmlDataSource>

I can edit the data, and when I look at it via the snippet below, I see the values are updated:

        For Each cl As TableCell In editingRow.Controls

            Dim contrl As Control = cl.Controls(0)
            If TypeOf contrl Is TextBox Then
                Dim newText As String = CType(contrl, TextBox).Text
            End If
        Next


However, when I write the .xml back via

   XmlSegments.Save()

The changes are not captured. What do I need to do before I write the file?
0
6rant6
Asked:
6rant6
  • 2
1 Solution
 
käµfm³d 👽Commented:
Please view the section "Editing XML Data Using the XmlDataSource Control" here:  http://msdn.microsoft.com/en-us/library/494y92bs.aspx
0
 
6rant6Author Commented:
Yes, I'd read that before.
0
 
6rant6Author Commented:
I guess the best anyone can come up with is Google MSDN?
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now