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
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