我将翻译以下代码:
我有以下的代码:
<asp:ListView ID="lvDetail" runat="server">
<ItemTemplate>
<tr>
<td><%# Eval("ShpNo")%></td>
<td><%# Eval("QtyShp")%></td>
<td><%# Eval("NumPallets")%></td>
</tr>
</ItemTemplate>
<LayoutTemplate>
<table id="tbl1" runat="server">
<tr id="tr1" runat="server">
<td id="td1" runat="server">ShpNo</td>
<td id="td2" runat="server">QtyShp</td>
<td id="td3" runat="server">NumPallets</td>
</tr>
<tr id="ItemPlaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
</asp:ListView>
在后端代码中:
List<Visibility> ListVisibility = new List<Visibility>();
public class Visibility
{
public int ShpNo;
public int QtyShp;
public int NumPallets;
public string ETA;
}
List<Visibility> items = ListVisibility.FindAll(VisibItem => VisibItem.ETA == Calendar1.SelectedDate.ToShortDateString());
lvDetail.DataSource = items;
lvDetail.DataBind();
但是当我绑定时,出现了以下错误:
<td><%# Eval("ShpNo")%></td>
DataBinding: 'AIS.WebVisibility+Visibility'不包含名称为'ShpNo'的属性。
为了从列表中获取正确的值,我需要做什么?
public int ShpNo { get; set; }
。 - Cᴏʀʏ