binding a gridview to xmldatasource gives "The data source for gridview gridview1 did not have any properties or attributes from which to generate columns. Ensure that your data source has columns

Greetings! 

I am new to asp.net forum so feel free to point me to the proper resources or forums.  I am using Visual Studio 2005.  I have a simple web page with a gridview control and an xmldatasource control.  I am getting the above error.  Can someone point out why I am getting the above error and what I need to do to resolve it?  Thanks in advance.

/////////////////////////////// default.aspx

 <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="default.aspx.vb" Inherits="XMLwalkthroughVB._default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitled Page</title>

</head>

<body>

<form id="form1" runat="server">

<div>

<asp:GridView ID="GridView1" runat="server" DataSourceID="XmlDataSource1">

</asp:GridView>

</div>

<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/App_Data/Caldata.xml">

</asp:XmlDataSource>

</form>

</body>

</html>

///////////////////////////////  caldata.xml

<?xml version="1.0" standalone="yes"?>

<Events_Table>

<Events>

<startdate>12/3/2007</startdate>

<enddate>12/15/2007</enddate>

<title>Title of event</title>

<description>Description of event description of event description ofc. </description>

<location>Los Angeles</location>

<staticurl></staticurl>

</Events>

<Events>

<startdate>12/5/2007</startdate>

<enddate>1/1/2008</enddate>

<title>New Event 2</title>

<description>Description event 2</description>

<location>Redmond</location>

<staticurl></staticurl>

</Events>

</Events_Table>

0
JeffWi
12/6/2007 6:10:58 AM
asp.net.xml-datasource 7181 articles. 0 followers. Follow

1 Replies
1137 Views

Similar Articles

[PageSpeed] 28

Bad xml...  Late at night...  Here is the solution:

 <Events startdate="12/3/2007" enddate="12/15/2007" title="Title of event" description="Description of event description of event description ofc." location="Los Angeles" staticurl="">

</Events>

0
jeffwi52
12/6/2007 5:50:45 PM
Reply:

Similar Artilces:

System.Web.HttpException: The data source for GridView with id 'GridView_Podcasts' did not have any properties or attributes from which to generate columns. Ensure that your data source has content.
Why am I getting this error?  All seems to be ok:<asp:XmlDataSource ID="PodcastsXML"  runat="server" DataFile="~/interact/podcasts/rss/podcast.xml" /><asp:GridView     ID="GridView_Podcasts"     runat="server"     AllowPaging="True"     DataSourceID="PodcastsXML"    EnableSortingAndPagingCallbacks = "true"    BackColor="LightGoldenrodYellow"     BorderColor="Tan"     BorderWidth="1px" &...

How to data format column in GridView that uses programmatically generated data source
I have a gridview object on the page but am not using any of the design-time tools for data. I have the data source initiated and binded programmatically, but be cause of this I cant figure out how to format my columns that display currency or date strings. they just show as doubles or full datetime strings. yuk. Is there a way to format these strings in the gridview without declaring them at design time?  You can handle the RowDataBound event and format the gridView cells :  protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row....

Gridview with Dictionary Data Source DataBind Error: A field or property with the name 'XXXX' was not found on the selected data source
I have created a custom type of Entity which I am storing in a dictionary. I'd like to use this dictionary as the datasource for a gridview. I thought I had things setup correctly and don't see much difference between what I have done and what is outlined here: http://forums.asp.net/t/1149549.aspx. However, when it comes time to do databinding I keep getting the exception: "A field or property with the name 'EntityID' was not found on the selected data source."  If I check to ensure that the EntityID is populated it always is so I am not sure what's going o...

Trying to use the FAQ " Sorting and paging in the GridView control when not using data source controls "Sorting and paging in the GridView control when not using..."
and I am not getting the results I had hoped for.  I keep getting a "Compiler Error Message: CS0123: No overload for 'AdhocJobGridView_PageIndexChanged' matches delegate 'System.EventHandler'".   Here is my event handling... protected void AdhocJobGridView_PageIndexChanged(object sender, GridViewPageEventArgs e){ try { AdhocJobGridView.DataSource = wsBaseInfoArray; AdhocJobGridView.PageIndex = e.NewPageIndex; AdhocJobGridView.DataBind(); }catch (Exception ex) {throw ex; }   Here is my aspx... <asp:GridView ID="AdhocJobGridView...

i have work on gridview control.in that i have 3columns.name as subject,bookname,link. in this some link column data are very large.according to that data(no spaces in that data)gridview has changed.i
hi,i have work on gridview control.in that i have 3columns.name as subject,bookname,link. in this some link column data are very large.according to that data(no spaces in that data)gridview has changed.i want display half of the data and remaining display like this.(ex:http://ww.yahoo.com...........).how can i display like this,and one more thing is always the column size will constant. Try something like this: <asp:templatefield headertext="Link"> <itemtemplate> <asp:hyperlink id="HyperLink1" runat="server" navigateurl='<...

how to update a data source when you have a custom column in a gridview
Hi Pre-amble. I have a bit of xml in my db that i display as part of a gridview. What I have done is to custom create a column which shows a drop down list in read mode and a checkboxlist in edit mode.These work fine when clicking the edit button on the grid. However how do i get the update part to work? Is there a method that I need to override?  I thought the overriding of the ExtractVeluesFromCell is doing the work needed but im only guessing... The error I get is cannot insert null into DB - which I am assuming means that 'speciality' isnt getting passed to the UpdateCom...

<%=Html.Select("State", ViewData)%> Can't bind to that data source. Consider using an IEnumerable data source such as an Array or collection
I cannot get this select to bind to a simple string array. [ControllerAction] public void OrderExample() { String[] states = new String[] { "AL", "AK", "AZ"}; RenderView("OrderExample", states); } Then in my View: <%=Html.Select("State", ViewData)%> Error: Can't bind to that data source. Consider using an IEnumerable data source such as an Array or collection It IS an array, ...

How do I Data Bind a GridView Control to an object data source that has imbedded objects
What follows are snippets of two classes that I am using: public class Location{ private string locationCode;  public String LocationCode {      get { return locationCode;}      set { locationCode = value; } }} public class User{ private Location location;  public Location Location {     get { return location;}     set { location = value} }}  I have bound a GridView control to a collection of User objects.  Within the GridView I need to display the ...

A data source instance has not been supplied for the data source "Proposal_Proposal"
Hi all. I am trying to display a local report as pdf. When I display the report normally in the report viewer it works fine, but when I try to use the ReportViewer1.LocalReport.Render method it gives the above error. I'll post my code, please help : 'Displaying of SSRS Reports 'Setting the ObjectDataSource properties dsReports.TypeName = Session("SSRSReportDataSet").ToString() + "TableAdapters." + Session("SSRSReportDataSet").ToString() + "TableAdapter" dsReports.SelectMethod = "GetData" 'Setting the report parametersD...

Gridview + Custom data source + sorting + hiding a column
HelloI'm building a simple search interface for my company’s active directory. After getting the data from the AD, I put it in a DataSet, add all my columns and the the rows. The DirectorySearcher class supports sorting, so I even got sorting to work (even, because this is my first asp.net experience :)). A few questions though:1. I want to hide a column (I need the data in that column when I select it). The only way I have managed to that, is with this rather nasty code (gvSearchResults is the Gridview that my resulting DataSet is bound to). Isn't there a better way?// Remove the "distingui...

Configure Data Source Source for Gridview
Hi, I am using VWD 2005 express and connected to my sql2005 database. I want to let the gridview I created to be editable so I want to turn on the option when I configure the data source. However I can NOT do it because the options are gray out on me. Does anybody knows why? and how to fixed this problem? Thanks JCH Hi JCH, My guess is that you are using a SQLDataSourceControl, and no update SQL statement has been set for it.  In this case, you can't perform edits -- since that needs an update statement. To enable edits, configure the data source again and choose the "advanced" b...

Displaying Gridview Data from a dataSet Source using Templatefield columns
Hi all, I have got a  gridviews  which i bind programmatically to a dataSet in my code behind code i.e gridview1.Datasource = dsTables[0]; gridview.DataBind() now when i use a default gridview( i.e in the Markup Page and i have not added any attributes to such as allowsorting e.t.c) it works but when i attempt to do this with a gridview which i want more control over i.e create all the columns, headertext, allowsorting allow paging and use Templatefields it does not work can anyone please explain this ? i have looked at a lot of code on the net and mine seems correct,...

Cannot add new data source
I am developing an ASP.Net web application in Visual Studio 2005 Professional.  I have a connection to a SQL Server in my Server Explorer.  I want to create a data source to the database so that I can drag-and-drop the table from the Data Sources pane onto my .ASPX form to auto-generate all the bound controls for each field in the table.  However, the Data Sources pane is greyed out, so I cannot add a new data source.  In addition, when I am viewing the greyed out Data Sources pane, there is no Data menu item to select Data->Add New Data Source.  Why is the Data S...

Generate trend line graph thumbnail using data in gridview and place it in additional gridview column
 Hi all! I have a gridview with 12 columns of numbers.  On each row of the gridview I would like to plot a small line graph image which uses these 12 numbers as it's points. I know how I can do it by creating a file from a bitmap and then creating a template column with an image control in it and setting the newly created file as the source but if possible I would like to completely skip the file creation process on the server.  The reason for this is that the data will be specific to the users session and will also be changing regularly so I will have to generate and...

Web resources about - binding a gridview to xmldatasource gives "The data source for gridview gridview1 did not have any properties or attributes from which to generate columns. Ensure that your data source has columns - asp.net.xml-datasource

The Parable of The Road Line Painter
-*+Way back in the day when lines were first being painted on roads. The early lines were painted by hand. In those days, a painter was hired ...

Mix08: The Good, the Bad, and the Ugly
The binding support in Silverlight 2 Beta ( Alright, I originally had this under The Bad , but it was brought to my attention (thanks Nick) that ...

Introduction - RazorFlow PHP Dashboard Framework - HTML5 Dashboards for web and mobile
RazorFlow PHP is a PHP Framework to easily build interactive, cross-device HTML5 dashboards with a fraction of the effort.

ASP.NET Pivot Table - RadPivotGrid for ASP.NET AJAX
... Try now! Use any declarative data source control (AccessDataSource, SqlDataSource, LinqDataSource, EntityDataSource, ObjectDataSource, XmlDataSource) ...

Delicious
Keep, share, and discover the best of the Web using Delicious, the world's leading social bookmarking service.

Resources last updated: 11/27/2015 7:29:02 AM