I have the following code:
<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>
And in the code behind:
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();
but I'm getting the following error when binding:
<td><%# Eval("ShpNo")%></td>
DataBinding: 'AIS.WebVisibility+Visibility' does not contain a property with the name 'ShpNo'.
What do I need to do in order to get the correct values from the List?
You have fields, instead of properties
public class Visibility
{
    public int ShpNo { get; set; }
    public int QtyShp { get; set; }
    public int NumPallets { get; set; }
    public string ETA { get; set; }
}
try that
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With