XML Data Source in GridView Control

R

Ron Ruble

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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,816
Latest member
nipsseyhussle

Latest Threads

Top