Loading image on to asp.net page

G

Guest

Hi Guys,

I asked this question yesterday, but have not yet received a suitable
answer. I hope you guys can help me out.

I want to load an image on to a web-page. The image is alreday stored in my
database. Currently when I load the image on to the page it loads on to the
full page using the following code: -

Response.ContentType = dr["paper_content"].ToString();
Response.BinaryWrite( (byte[]) dr["paper_data"] );

I want the image to be loaded on to a logical section in the page and I want
to use the rest of the page for some more controls that will be needed to
control the loading of different images in the same area as the earlier image
was loaded.

I hope you get what I am trying to explain. I'd really appreciate if anybosy
could help me out here,

Many Thanks,

I.A
 
M

Mark Fitzpatrick

When it comes to writing images to the browser you have to have the image be
the only thing since it is a binary block, can't mix HTML and other
elements. What you do instead is, have one page that generates the image and
does that alone. You can then call that page in the src attribute for an
image tag like so: <img src="myimage.aspx"> It works just as if it was a
regular image being referenced. You can also use an asp:image control to get
a little more control over the source of the image, such as appending
querystring variables to control how the image appears.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage
 

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

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,244
Latest member
cryptotaxsoftware12

Latest Threads

Top