【发布时间】:2012-09-21 16:06:45
【问题描述】:
我正在尝试使用详细信息视图。
这是我的数据源
我是这样传递的。
IEnumerable<DataRow> row = Connection.GetDataTable([sql]).AsEnumerable();
this.dvOrderInformation.DataSource = row;
this.dvOrderInformation.DataBind();
我是这样绑定的。
<asp:DetailsView ID="dvOrderInformation" runat="server" Height="50px" Width="100%" AutoGenerateRows="false">
<HeaderTemplate>
Order
</HeaderTemplate>
<FieldHeaderStyle Width="150px" />
<Fields>
<asp:BoundField HeaderText="Order Number:" DataField="OrderID" />
</Fields>
</asp:DetailsView>
当我尝试这个时,我会收到消息。
DataBinding: 'System.Data.DataRow' does not contain a property with the name 'OrderID'.
或
A field or property with the name 'OrderID' was not found on the selected data source.
如果我将它直接绑定到 DataGrid,它可以正常工作。任何想法我在这里做错了什么。
【问题讨论】:
标签: c# asp.net .net detailsview