Imagefield Nulldisplaytext problem

K

kbutterly

Good morning all,

I have a product database in which I store some images. I have created
a showThumbnail.aspx page to display the thumbnail image. This page has
no code on it, just the Page directive. The code behind,
showThumbnail.aspx.vb, has this in the Page_Load:
Dim productID As Integer =
Convert.ToInt32(Request.QueryString("ProductID"))

Dim dset As New GroovyGourmet.ProductSmallImageDataTable
ImageAdapter.FillActiveProductSmallImageDataByProductID(dset,
productID)

If Not dset.Rows.Count = 0 Then
Response.ContentType = dset.Rows(0)("sm_img_contenttype")
Response.BinaryWrite(dset.Rows(0)("sm_img_data"))
End If

The page with the gridview has the following as the imagefield
attributes:

<asp:ImageField
HeaderText="Photo"
DataImageUrlField="ProductID"
DataImageUrlFormatString="showThumbnail.aspx?ProductID={0}"
DataAlternateTextFormatString="Photo of {0}"
NullDisplayText="Picture unavailable" />

When there is no image for a product, the gridview is showing the red
'x' instead of my nulldisplaytext value.

What am I missing? Do I need an 'else' clause in the
showThumbnail.aspx.vb? Right now, if there is no text, the
response.contentType defaults to 'text/html'. Do I need to force it to
'image/pjpeg'? if so, what do I pass to BinaryWrite?

Thanks for any assistance,
Kathryn
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top