We help IT Professionals succeed at work.
Get Started

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

jsvb1977
jsvb1977 asked
on
1,055 Views
Last Modified: 2013-11-07
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
Comment
Watch Question
Senior .Net Developer
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE