SMLDatasource error

  • Thread starter Thread starter William LaMartin
  • Start date Start date
W

William LaMartin

I am finding the switch to Visual Studio 2005 from 2003 a bit of a problem
at times. My latest problem is that when I add an XMLDatasource to an aspx
page and set its datafile to an xml file (with or without accompanying XSD
file), then add a gridview control to the page and set its datasource to the
XMLDatasource, I receive the following 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.

My XML file has content. Makes we want to return to reading XML files into
a dataset, then using the dataset or an associated dataview as a datasource.

What could be the problem?
 
William said:
I am finding the switch to Visual Studio 2005 from 2003 a bit of a problem
at times. My latest problem is that when I add an XMLDatasource to an aspx
page and set its datafile to an xml file (with or without accompanying XSD
file), then add a gridview control to the page and set its datasource to the
XMLDatasource, I receive the following 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.

My XML file has content. Makes we want to return to reading XML files into
a dataset, then using the dataset or an associated dataview as a datasource.

What could be the problem?

Set AutoGenerateColumns = "false". Below is the code from my app

<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<%#XPath("ID")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Title">
<ItemTemplate>
<%#XPath("TITLE")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Content">
<ItemTemplate>
<%#XPath("CONTENT")%>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:HyperLink Text="Edit"
runat="server"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
 

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

Back
Top