Solved

Updating xmldatasource from gridview

Posted on 2010-09-02
3
650 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
  • 2
3 Comments
 
LVL 74

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
Comment Utility
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
Comment Utility
Yes, I'd read that before.
0
 
LVL 1

Author Closing Comment

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

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now