Link to home
Start Free TrialLog in
Avatar of jsvb1977
jsvb1977

asked on

DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'LeadTime'

I have a web application written in C#.
I have added the following code to an Item Template in a DataGrid.
<%# ((Convert.ToInt32(DataBinder.Eval(Container.DataItem, "LeadTime"))) > 0) ? "+" + DataBinder.Eval(Container.DataItem, "LeadTime") : "&nbsp;"%> 

Open in new window

I have modified the Stored Procedure to Include a Column called "LeadTime".
I have stepped throught the code but am unable to locate the source of this error:

DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'LeadTime'.

Open in new window


I am at a loss. I do not know where to go from here.
Can someone assist in trouble shooting this error?

Here is a section of the code from the data grid on the aspx side.

		
<asp:TemplateColumn SortExpression="ModelNumber" HeaderText="Product&lt;br/&gt;Code">
			<HeaderStyle HorizontalAlign="Center"></HeaderStyle>
			<ItemStyle HorizontalAlign="Center" Width="100"></ItemStyle>
			<ItemTemplate>
			    <span class="leadtime">
				<%# ((Convert.ToInt32(DataBinder.Eval(Container.DataItem, "LeadTime"))) > 0) ? "+" + DataBinder.Eval(Container.DataItem, "LeadTime") : "&nbsp;"%> 
				</span> 
				<asp:label id="ProductID" runat="server" text='<%# DataBinder.Eval(Container.DataItem, "ProductID") %>' />
				&nbsp;<%# ((bool)DataBinder.Eval(Container.DataItem, "AdItem")) ? 
                  (DataBinder.Eval(Container.DataItem, "Quantity")==DBNull.Value || ((int)DataBinder.Eval(Container.DataItem, "Quantity"))<1) ? 
                    "<font color=red><b>$</b></font>" : "<font color=green><b>$</b></font>"
                  : "" %>
			</ItemTemplate>
		</asp:TemplateColumn>

Open in new window


Something worth mentioning:
This app is an Online Ordering System. It contains two pages that use the same User Control and datagrid. The first page renders all products available and loads succesfully with the modification outlined above [LeadTime]. The second page is the Order [It contains all the products that the customer has added to their cart].

The cart page is the one that is causing the error.
But again, they use the same datagrid, but call different stored procedures.

Thanks for any insight you can give.
Jason
ASKER CERTIFIED SOLUTION
Avatar of Jini Jose
Jini Jose
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jsvb1977
jsvb1977

ASKER

Yes, the sp being called for the cart page contains a column called "LeadTime"
looks like the cart class also called ANOTHER sp to perform a check for 'New Items.' This sp doesnt render via the datagrid in question [or maybe it does?]...

either way, adding LeadTime to this new found sp remedied the error.

Jason