Click here to Skip to main content
15,890,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
BatchNum, Quantity, Status are bounded fields from database, now I want to add a field SelectedQuantity but it is not implementing and generating the following error

C#
(DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'SelectedQuantity'.)

ASP.NET
<itemtemplate>
    <tr style="">
        <td> 
            <asp:CheckBox ID="chckSelect" runat="server" />
        </td>
        <td>
            <asp:Label ID="lblBatchNo" runat="server" Text='<%# Eval("BatchNum") %>' />
        </td>                                                                        
        <td>
            <asp:Label ID="lblQty" runat="server" Text='<%# Eval("Quantity") %>' />
        </td>
        <td>
            <asp:Label ID="lblSelQty" runat="server" Text='<%# Eval("SelectedQuantity") %>' />--In This Line I am Getting Error.
        </td>
        <td>
            <asp:Label ID="lblStatus" runat="server" Text='<%# Eval("Status") %>' />
        </td>
    </tr>
</itemtemplate>
<layouttemplate>
<table id="Table1"  runat="server">
    <tr id="Tr2"  runat="server">
    
        <td id="Td1"  runat="server">
            <table ID="itemPlaceholderContainer"  runat="server" border="2" style="">
                <tr id="Tr1"  runat="server" style="">
                    <th id="Th1"  runat="server">
                        <asp:Label ID="Label1" Width="10px" runat="server" Text="">
                    
                    <th id="Th6"  runat="server">
                        <asp:Label ID="lblBatch" Width="100px" runat="server" Text="BatchNo">
                    
                    <th id="Th5"  runat="server">
                        <asp:Label ID="lblQty" Width="100px" runat="server" Text="Quantity">
                    
                    <th id="Th7"  runat="server">
                        <asp:Label ID="lblStatus" Width="100px" runat="server" Text="Status">
                    
                    <th id="Th8"  runat="server">
                        <asp:Label ID="lblSelQty" Width="100px" runat="server" Text="SelectedQuantity">
        
    <tr ID="itemPlaceholder"  runat="server">       
</layouttemplate>
Posted
v2
Comments
Thomas ktg 19-Sep-13 7:27am    
Make sure the listview datasource has SelectedQuantity and check your select statement.

1 solution

Quote:
C#
(DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'SelectedQuantity'.)

The error is quite clear.

It says the DataSource, which is getting bound to the ListView does not contain any column 'SelectedQuantity'.

Please add that column to the DataSource (in the Query fetching the data from Database) in order to use it inside Mark-up.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900