Below is the XML file I'm using which is popualting my grid
successfully:

(Ideally I would like to avoid using buttons on my grid and attaching
an event handler for double-clicking a displayed row on the grid.)

I have this code wich is working well at adding "topics" to my XML
file, but on using XPathNavigator to edit, I'm lost on that one:

    Private Sub btnSubmit_Click(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles btnSubmit.Click
        Using ds As New DataSet()
            ds.ReadXml(Server.MapPath("history.xml"))
            Dim dr As DataRow = ds.Tables(0).NewRow()
            dr("eventID") = txtEventID.Text
            dr("event") = txtNewEvent.Text
            dr("year") = txtDate.Text
            ds.Tables(0).Rows.Add(dr)
            ds.WriteXml(Server.MapPath("history.xml"))
       End Using
    End Sub

<?xml version="1.0" standalone="yes"?>
<events>
  <topic>
    <eventID>1001</eventID>
    <event>Bay of Pigs</event>
    <year>1961</year>
  </topic>
  <topic>
    <eventID>1002</eventID>
    <event>Vienna Summit with Soviet Premier Nikita Kruschev</event>
    <year>1961</year>
  </topic>
  <topic>
    <eventID>1003</eventID>
    <event>Cuban Missle Crisis</event>
    <year>1962</year>
  </topic>
</events>

On Dec 17, 2:20 pm, Cerebrus <[email protected]> wrote:
> On Dec 17, 1:23 am, Brock <[email protected]> wrote:
>
> > Thanks Cerebus... you're the best
>
> I'm also the most absent minded. I forgot all about your data being
> XML halfway through writing my reply. :P
>
> On second thoughts, however, maybe that impression was propagated by
> your use of a DataView. IMO, you can directly bind a Datagrid to an
> XML file (eg, using XmlDataSource) without going through the XML ->
> DataSet -> DataView route.
>
>
>
>
>
> > I think the Querystring is my best bet with a details view on
> > another .aspx page.
> > I've had a devil of a time finding any textbook examples or web
> > resources for embedding
> > SELECT-FROM-WHERE type sql querying to choose a particular node of the
> > XML file
> > and make the node's data accessible to the new .aspx page through a
> > querystring.
> > I've seen some reference to the "FOR XML AUTO" phrase but I'm not sure
> > if that
> > is on the right track (?). Any examples in websites would be very
> > helpful. This is not part of my job
> > but I just personally want to learn how to query into XML files to
> > grab "records/nodes", edit them, delete, etc.
> > I use vb.net and know nothing of C# (us vbers are "parenthetically
> > challenged", pardon my humor!)
>
> Since we're selecting XML, our best bet is to use .NET's built in
> capabilities for selecting and querying XML. Use the XPathNavigator
> with an appropriate XPath expression. (If you have trouble with this
> part, post the XML and what you want to select) to return another
> XPathNavigator that can be assigned to the Datasource property of the
> FormView / DetailsView.- Hide quoted text -
>
> - Show quoted text -

Reply via email to