Joe W
Joe W

Reputation: 1567

DataBinding: Does not contain a property with then name '(columnName)'

I just finished one thing to come up with yet another problem with databinding.

I just implemented a select statement that joins 2 tables so on my asp page I can look at a column in the 2nd table and see if there is or is not an integration being made, and vary the results on that note

I have looked at similar problems and tried the solutions but it has not worked for me. The exact error message is:

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

The Select Statement:

SELECT productid, 
       productname, 
       productsku, 
       quantity, 
       productprice, 
       productprice * quantity AS totalprice, 
       shoppingcartrecid, 
       uom, 
       packingslip, 
       logodesignnumber, 
       customtext, 
       nametext, 
       extracharge, 
       custitem, 
       t1.catalogtype, 
       catalogid, 
       relatedchargeid, 
       upsflag 
FROM   shoppingcart t1 
       INNER JOIN itemcatalogprofile t2 
         ON t1.catalogtype = t2.catalogtype 

Where Im using it:

<asp:HyperLink ID="HyperLink" runat="server" style="cursor:pointer; text-decoration:none;"
 NavigateUrl='<%# (Eval("Integration").ToString() == "Y") ? String.Format("~integration/vendorframe.aspx?CatalogID={0}",Eval("CatalogID")) : String.Format("~/storefront.aspx?CatalogID={0}",Eval("CatalogID"))%>'>

If there is any other info I you need I will try and get it, any help is appreciated.

Thanks

There were 2 parts to the answer:

First, I completly forgot to add t2.Integration to my select this morning after I did when I ran it on a test query

Second, I was using : Eval("Integration").ToString() .. after I took ToString off the page started working.. Thank you all

Upvotes: 2

Views: 2659

Answers (3)

James Johnson
James Johnson

Reputation: 46047

It looks like the Integration and CatalogID columns are missing from the select statement.

Upvotes: 1

Josh
Josh

Reputation: 44906

There doesn't appear to be an "Integration" column in your query anywhere.

Upvotes: 1

Doozer Blake
Doozer Blake

Reputation: 7797

There isn't a column called Integration, which would cause the error you are having.

Doing an INNER JOIN is automatically not going to show the things that don't exist. You need to change your SQL statement to an OUTER JOIN, and then check for the existence of some field withi the ItemCatalogProfile table.

Upvotes: 1

Related Questions