473,322 Members | 1,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Container.DataItem Question

My SQL statement is as follows:

Dim strSQL = "SELECT tblDescription.ASIN, tblDescription.strTitle,
tblDescription.strArtist, tblDescription.strReview,
tblDescription.strImageDir, tblStyleASIN.StyleID, tblStyleASIN.ASIN " &
_
"FROM tblStyles INNER JOIN (tblDescription INNER JOIN
tblStyleASIN ON tblDescription.ASIN = tblStyleASIN.ASIN) ON
tblStyles.StyleID = tblStyleASIN.StyleID " & _
"WHERE tblStyles.StyleID = " & strID & ";"

This is bound to a DataList in the body of my ASP.NET page. The problem
is I run into an error when I input the following into my datalist:

<a href="ProductPage.aspx?ASIN=<%# DataBinder.Eval(Container.DataItem,
"ASIN") %>">Read More</a></FONT>

The error I get is:

Exception Details: System.Web.HttpException: DataBinder.Eval:
'System.Data.Common.DbDataRecord' does not contain a property with the
name ASIN

Could it be that I have a couple of different possible ASIN fields such
as tblDescription.ASIN, tblStyleASIN.ASIN, etc. . .? I want
Container.DataItem, "ASIN) to equal tblDescription.ASIN. Is there a way
to go about doing this?

Thanks in advance!

Nov 19 '05 #1
6 1210
How about

Dim strSQL = "SELECT tblDescription.ASIN,
tblDescription.strTitle,
tblDescription.strArtist, tblDescription.strReview,
tblDescription.strImageDir, tblStyleASIN.StyleID,
tblStyleASIN.ASIN AS ASIN_Style FROM ..."

HTH,

Elton Wang
-----Original Message-----
My SQL statement is as follows:

Dim strSQL = "SELECT tblDescription.ASIN, tblDescription.strTitle,tblDescription.strArtist, tblDescription.strReview,
tblDescription.strImageDir, tblStyleASIN.StyleID, tblStyleASIN.ASIN " &_
"FROM tblStyles INNER JOIN (tblDescription INNER JOINtblStyleASIN ON tblDescription.ASIN = tblStyleASIN.ASIN) ONtblStyles.StyleID = tblStyleASIN.StyleID " & _
"WHERE tblStyles.StyleID = " & strID & ";"

This is bound to a DataList in the body of my ASP.NET page. The problemis I run into an error when I input the following into my datalist:
<a href="ProductPage.aspx?ASIN=<%# DataBinder.Eval (Container.DataItem,"ASIN") %>">Read More</a></FONT>

The error I get is:

Exception Details: System.Web.HttpException: DataBinder.Eval:'System.Data.Common.DbDataRecord' does not contain a property with thename ASIN

Could it be that I have a couple of different possible ASIN fields suchas tblDescription.ASIN, tblStyleASIN.ASIN, etc. . .? I wantContainer.DataItem, "ASIN) to equal tblDescription.ASIN. Is there a wayto go about doing this?

Thanks in advance!

.

Nov 19 '05 #2
How about

Dim strSQL = "SELECT tblDescription.ASIN,
tblDescription.strTitle,
tblDescription.strArtist, tblDescription.strReview,
tblDescription.strImageDir, tblStyleASIN.StyleID,
tblStyleASIN.ASIN AS ASIN_Style FROM ..."

HTH,

Elton Wang
-----Original Message-----
My SQL statement is as follows:

Dim strSQL = "SELECT tblDescription.ASIN, tblDescription.strTitle,tblDescription.strArtist, tblDescription.strReview,
tblDescription.strImageDir, tblStyleASIN.StyleID, tblStyleASIN.ASIN " &_
"FROM tblStyles INNER JOIN (tblDescription INNER JOINtblStyleASIN ON tblDescription.ASIN = tblStyleASIN.ASIN) ONtblStyles.StyleID = tblStyleASIN.StyleID " & _
"WHERE tblStyles.StyleID = " & strID & ";"

This is bound to a DataList in the body of my ASP.NET page. The problemis I run into an error when I input the following into my datalist:
<a href="ProductPage.aspx?ASIN=<%# DataBinder.Eval (Container.DataItem,"ASIN") %>">Read More</a></FONT>

The error I get is:

Exception Details: System.Web.HttpException: DataBinder.Eval:'System.Data.Common.DbDataRecord' does not contain a property with thename ASIN

Could it be that I have a couple of different possible ASIN fields suchas tblDescription.ASIN, tblStyleASIN.ASIN, etc. . .? I wantContainer.DataItem, "ASIN) to equal tblDescription.ASIN. Is there a wayto go about doing this?

Thanks in advance!

.

Nov 19 '05 #3
That way wouldn't work because there are 3 different tables that I am
relationing.

Nov 19 '05 #4
That way wouldn't work because there are 3 different tables that I am
relationing.

Nov 19 '05 #5
Did it try it? What Elton means, you can rename result set columns as you
wish with AS keyword.

You should be able also to use
DataBinder.Eval(Container.DataItem,"tblDescription .ASIN")

Eliyahu

"Sparky Arbuckle" <tw*@secureroot.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
That way wouldn't work because there are 3 different tables that I am
relationing.

Nov 19 '05 #6
Did it try it? What Elton means, you can rename result set columns as you
wish with AS keyword.

You should be able also to use
DataBinder.Eval(Container.DataItem,"tblDescription .ASIN")

Eliyahu

"Sparky Arbuckle" <tw*@secureroot.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
That way wouldn't work because there are 3 different tables that I am
relationing.

Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: az bij | last post by:
Hi, I have a dataset bound to a repeater and want to place some logic in my ascx file. I want to display an image link if and only if an image is available. I have tried without success...
1
by: Mike P | last post by:
I'm having trouble with C# syntax for Container.DataItem. This is the VB version. CAn anybody help me out with the syntax? <asp:DataList runat="server" id="dlResults" Font-Name="Verdana"...
1
by: Chris Fink | last post by:
Hi, My question is how do I set some text within my datalist itemtemplate to be bold, based on the higher value of two bound data items? For example, if the value of <%#...
1
by: anony | last post by:
Hi, I would like to find out if it's possible to check the value of a Container.DataItem inside the Datagrid's <ItemTemplate> tag .... based on it's value, I would to either output it or output...
5
by: bg | last post by:
Hi! How do I check if "date" exists before using that code? I've built a RSSreader and sometimes there's a date in it and sometimes not. How can I check if it exists to avoid crash...
4
by: hsomob1999 | last post by:
I have a class, lets call it Schmuck. It has 2 public properties Name (string) and active (boolean). When I bind to a Repeater, like so: <%#container.dataitem("Name")%> i get the following error:...
2
by: Antony | last post by:
Hello, in my aspx.file I have this code inside a datagrid: <asp:TemplateColumn HeaderText="Picture"> <ItemTemplate> <asp:Image id="Image1" runat="server" ImageUrl='upload/<%#...
0
by: John Davis | last post by:
Hi all, hope you are well. I would like to know if I can access the strongly typed properties of my datatable when binding through the ObjectDataSource object. I am currently creating some...
0
by: John Davis | last post by:
Hi all, hope you are well.(not sure if this posted the first time) I would like to know if I can access the strongly typed properties of my datatable when binding through the ObjectDataSource...
3
by: alberthung01 | last post by:
Hi all, I try to use Container.DataItem() in my DataGrid's ItemTemplate. Somewhere it works fine. eg.<input type=checkbox id='cb_select_<%# Container.DataItem("TAG_ID") %>' value='<%#...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.