Binding XML to Datagrid

Discussion in 'ASP .Net Datagrid Control' started by Do, Aug 24, 2004.

  1. Do

    Do Guest

    Hi,

    I tried to bind an XML similar to the following to a datagrid.

    <Idontwant>
    <Iwant>
    <Yes></Yes>
    <Yes></Yes>
    <Yes></Yes>
    <Yes></Yes>
    <Yes></Yes>
    </Iwant>
    </Idontwant>

    The datagrid comes up with nothing. When I remove the node 'Idontwant' and
    have the
    'Iwant' and the root node, everything shows up correctly in the datagrid.
    But removing the
    'Idontwant' node is not an option of mine.

    I want to be selective on the level or group of nodes that I bind to the
    datagrid, so I can just
    choose everything in //Idontwant/Iwant. How do choose just a portion of the
    XML structure?

    Code examples and links would be awesome!

    Thanks,

    Do
     
    Do, Aug 24, 2004
    #1
    1. Advertising

  2. Hi Do,

    Try drilling down into the Tables collection to see if that brings back the
    data you want:

    Dim ds As New DataSet
    ds.ReadXml(Server.MapPath("dbxml.xml"))
    DataGrid1.DataSource = ds.Tables(1)
    DataGrid1.DataBind()

    Ken

    "Do" <> wrote in message
    news:...
    > Hi,
    >
    > I tried to bind an XML similar to the following to a datagrid.
    >
    > <Idontwant>
    > <Iwant>
    > <Yes></Yes>
    > <Yes></Yes>
    > <Yes></Yes>
    > <Yes></Yes>
    > <Yes></Yes>
    > </Iwant>
    > </Idontwant>
    >
    > The datagrid comes up with nothing. When I remove the node 'Idontwant'
    > and
    > have the
    > 'Iwant' and the root node, everything shows up correctly in the datagrid.
    > But removing the
    > 'Idontwant' node is not an option of mine.
    >
    > I want to be selective on the level or group of nodes that I bind to the
    > datagrid, so I can just
    > choose everything in //Idontwant/Iwant. How do choose just a portion of
    > the
    > XML structure?
    >
    > Code examples and links would be awesome!
    >
    > Thanks,
    >
    > Do
    >
    >
     
    Ken Cox [Microsoft MVP], Aug 27, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jordan
    Replies:
    2
    Views:
    2,547
    Jordan
    Feb 10, 2004
  2. Amit
    Replies:
    6
    Views:
    13,842
    Assimalyst
    Oct 24, 2006
  3. Replies:
    2
    Views:
    874
    Kevin Grover
    Oct 20, 2006
  4. JcFx
    Replies:
    0
    Views:
    291
  5. Vivek Nallur

    value binding and function binding

    Vivek Nallur, Sep 25, 2003, in forum: Ruby
    Replies:
    0
    Views:
    139
    Vivek Nallur
    Sep 25, 2003
Loading...

Share This Page