【问题标题】:Displaying XML in Grid View-newbie在网格视图中显示 XML-新手
【发布时间】:2015-03-07 23:19:08
【问题描述】:

我正在尝试在 VisualWebDev 2008 Express 中做一些我认为很简单的事情,但它不起作用。我想显示 XML 文件中的数据,所以我将 XMLDataSource 添加到我的页面,将其指向 XML 文件,然后添加 GridView 并将其连接到数据源。我收到以下错误: GridView - GridView1呈现控件时出错。 ID 为“GridView1”的 GridView 的数据源没有用于生成列的属性或属性。确保您的数据源有内容。

谁能告诉我我可能做错了什么, TIA 院长

我的 XML 中的一个 sn-p 如下:

<?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>

【问题讨论】:

    标签: xml visual-studio gridview


    【解决方案1】:

    您的 XML 不是 well formed。浏览 XML 并使用适当的 entity references 删除或转换非法字符。检查格式是否正确的一种简单方法是将数据保存在 xml 文件中,然后尝试使用 IE 或 Firefox 打开它。浏览器会告诉它在哪里阻塞了数据。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-04-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-24
      • 1970-01-01
      相关资源
      最近更新 更多