2008-11-10 114 views
2

我想在VisualWebDev 2008 Express中做一些我认为很简单的事情,但它不工作。我想显示来自XML文件的数据,因此我将XMLDataSource添加到了我的页面,将它指向XML文件,然后添加了GridView并将其连接到数据源。我收到以下错误: GridView - GridView1呈现控件时出错。 具有id'GridView1'的GridView的数据源没有用于生成列的属性或属性。确保您的数据源包含内容。在网格视图中显示XML-newbie

可能有人请告诉我,我可能是做错了, 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 &amp; 9F and Land Lots 117, 143 &amp; 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

您的XML不是w^ell formed。浏览XML并使用相应的entity references删除或转换非法字符。检查格式良好的简单方法是将数据保存在xml文件中,并尝试使用IE或Firefox打开它。浏览器会告诉它在数据上的阻塞位置。