Solved

Updating xmldatasource from gridview

Posted on 2010-09-02
3
657 Views
Last Modified: 2013-11-27
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
Comment
Question by:6rant6
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 33591706
Please view the section "Editing XML Data Using the XmlDataSource Control" here:  http://msdn.microsoft.com/en-us/library/494y92bs.aspx
0
 
LVL 1

Author Comment

by:6rant6
ID: 33592680
Yes, I'd read that before.
0
 
LVL 1

Author Closing Comment

by:6rant6
ID: 33647930
I guess the best anyone can come up with is Google MSDN?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question