How to hide rows with spacer images (1x1 pixel) in asp.net gridview

S

Samy

Hi There,

I am trying to display images in a gridview and display only valid
images from the html in the database (and not display spacers, 1x1
pixel images etc). For this, I have a gridview with an asp:Image
control in one of its template. I populate the image by setting the
imageurl (remote url) of the image in the rowdatabound event of the
gridview. I have an aspx page called draw.aspx and i do it this way..

imageurl = draw.aspx?imageurl=url

In the draw.apxz.cs, i have a method which takes the url and using the
webclient, creates a bitmap and saves that to the response like this..

bmp.Save(Response.OutputStream, bmp.RawFormat);

This works fine, but all images are displayed in the gridview. I would
like to check for the height and width of the image and not show the
rows of the gridview based on those attributes. . I am doing it in the
PreRender event, trying to check the height and width of the image in
each row of the gridview. For some reason, if I debug the code, I see
that both height and width of the image are 0. First thing, I am not
sure why both are 0. Secondly, I am wondering what is the best way of
checking this and where(which event) should this be checked?

I really appreciate your suggestions and recommendations.

Thanks a lot!!
 

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,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top