2008-11-10 105 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打開它。瀏覽器會告訴它在數據上的阻塞位置。