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 LaMartin wrote:
> 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
0 comments:
Post a Comment