XML Data Source in GridView Control

Discussion in 'ASP .Net Web Controls' started by Ron Ruble, Apr 16, 2007.

  1. Ron Ruble

    Ron Ruble Guest

    I have a data source containing XML data.

    Please note that the XML data is not from a query against a SQL data source
    "for XML". It's created externally and stored.

    I need to display it in a GridView. No inserts, updates, deletes, filters of
    XPath queries. Just display. I load the XML in an XML Data Source, and try to
    display it in the GridView, and I get back this error.

    "The data source for GridView with id 'GridView1' did not have any
    properties or attributes from which to generate columns. Ensure that your
    data source has content."

    I can apply an XSLT transform to the data to add any required attributes;
    that's no problem. The problem is that I have no clue what attributes the
    GridView -expects- in order to generate columns. I'm building a source for
    others to use in web pages, so I really don't want to specfiy the columns
    directly; I'd prefer that they can use the autogenerate feature.

    I'd alsoe prefer not to have to load it into a DataSet or other; it just
    seems ridiculous to have to keep taking XML and filtering it through more and
    more objects just to display it in a grid.

    Here's a very reduced set of the XML:

    <root>
    <row>
    <LID>103432946</LID>
    <LACID>5533592</LACID>
    <LENID>9449861</LENID>
    <Message>CSPL Incomplete Data</Message>
    </row>
    <row>
    <LID>104143441</LID>
    <LACID>5600581</LACID>
    <LENID>9484344</LENID>
    <Message>CSPL Incomplete Data</Message>
    </row>
    </root>

    I've tried adding an attribute called "name" one called "type", "value" etc.
    But I can't guess what attributes the GridView expects.

    How do I need to specify the attributes of XML columns for the GridView?
     
    Ron Ruble, Apr 16, 2007
    #1
    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. ~~~ .NET Ed ~~~
    Replies:
    1
    Views:
    4,227
    Cowboy \(Gregory A. Beamer\)
    Feb 26, 2005
  2. Marcus Leon
    Replies:
    5
    Views:
    613
    Marcus Leon
    Feb 3, 2005
  3. =?Utf-8?B?bWdvbnphbGVzMw==?=

    GridView Hierarchical View - Gridview in Gridview

    =?Utf-8?B?bWdvbnphbGVzMw==?=, May 9, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    18,046
    =?Utf-8?B?UGhpbGxpcCBXaWxsaWFtcw==?=
    May 9, 2006
  4. Author Tarun Tyagi
    Replies:
    0
    Views:
    753
    Author Tarun Tyagi
    Dec 29, 2004
  5. Allan Ebdrup
    Replies:
    2
    Views:
    517
    Allan Ebdrup
    Oct 6, 2006
Loading...

Share This Page