我正在尝试在VisualWebDev 2008 Express中做一些我认为很简单的事情,但它无法正常工作。我想显示XML文件中的数据,因此我将XMLDataSource添加到我的页面,将其指向XML文件,然后添加GridView并将其连接到数据源。我收到以下错误: GridView - GridView1渲染控件时出错。 ID为'GridView1'的GridView的数据源没有用于生成列的属性或属性。确保您的数据源包含内容。
有人可以告诉我,我可能做错了什么, TIA 迪安
我的XML片段如下:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Schools xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SchoolProjects>
<Project>6019 - Renaissance MS - New School</Project>
<School>Renaissance MS</School>
<School_Address>7155 Hall Road Fairburn, GA 30213</School_Address>
<Cluster> NS-6019200-LA-01 </Cluster>
<Project_Type>New School</Project_Type>
<Phase>Close-out</Phase>
<Proj_Num>NS-6019200</Proj_Num>
<SqFt>0.000000000000000e+000</SqFt>
<Scope>The construction of the new Renaissance MS will be at the intersection of Jones/Hall Road, in the districts 7th & 9F and Land Lots 117, 143 & 146 of Fulton County, GA. The work includes the construction of the 180,500 square foot building that will house 34 standard classrooms, 12 standard science labs, 20 special purpose classrooms, cafeteria and litchen, gymnasium, media center and administrative offices. The site will also have multi-purpose playfields with track, softball field, tennis courts and basketball/volleyball court.</Scope>
<Project_Manager>Terry O'Brien</Project_Manager>
<PM_Firm>Parsons</PM_Firm>
<AE_Firm>Stevens Wilkinson Stang Newdow</AE_Firm>
<Contractor>Barton Malow</Contractor>
<Start_date xsi:nil="true" />
<End_Date xsi:nil="true" />
<WebAddress></WebAddress>
<Longitude>-84.62242</Longitude>
<Latitude>33.61497</Latitude>
</SchoolProjects>
...
</Schools>
答案 0 :(得分:0)
您的XML不是w ell formed。浏览XML并使用适当的entity references删除或转换非法字符。检查格式良好的一种简单方法是将数据保存在xml文件中,并尝试使用IE或Firefox打开它。浏览器会告诉它在数据上的阻塞位置。