Link to home
Start Free TrialLog in
Avatar of 6rant6
6rant6Flag for United States of America

asked on

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?
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of 6rant6

ASKER

Yes, I'd read that before.
Avatar of 6rant6

ASKER

I guess the best anyone can come up with is Google MSDN?