0
我試圖用VB在ASP中使用GridView和我得到的關於內容的錯誤消息。我做了一些研究,並重新格式化數據源被引用,但仍不能似乎得到GridView控件生成的XML文檔。asp.Net的ListView/GridView的數據綁定錯誤
錯誤消息:「ID爲‘GridView1’沒有任何屬性或屬性從中生成列的GridView的數據源,確保您的數據源有內容。」
XML片段:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<financialExpenditures2>
<expenses>
<expense Reporting="" Obj="val" Sub-Obj="" Doc_Code="val" Doc_Dep="val" Document_ID="val" Record_Date="val" FY="val" BFY="val" Acct_Per="val" Fund="val" Department="val" Unit="val" Sub-unit="" Activity="val" Vendor_Code="" Vendor_Name="" Check_Num="" Vendor_Invoice_Num="" Posting_Code="val" Sub_unit="" Posting_Amt="val" Comm_Ln_Num="val" Acct_Ln_Num="val" Accounting_Line_Desc="longer string val"/>
</expenses>
</financialExpenditures>
查看頁面代碼
<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
CodeBehind="Default.aspx.vb" Inherits="WebApplication2._Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
Welcome to ASP.NET!
</h2>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" DataSourceID="conversionBook2">
</asp:GridView>
<asp:XmlDataSource ID="conversionBook2" runat="server"
DataFile="~/conversionBook2.xml"></asp:XmlDataSource>
</div>
</form>
</asp:Content>
奏效,謝謝! – Mark 2010-10-18 16:45:44