Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Dynamic Image from Database

Reply
Thread Tools

Dynamic Image from Database

 
 
Joe Reiss
Guest
Posts: n/a
 
      05-08-2006
Hi All,

Using vs2005, C#, SQL Server 2005/Shared Environment.

I'm attempting to populate an image control from a jpeg stored in a image
field in sql server. Tried using both HTML image and ASP image - can't get
either to work.

I'm basically using the technique outlined in the ASP.NET 2.0 Cookbook
(OReilly).

So, in my page that has the image controls the code in the view photo button
event is

img.Src = "LoadPhoto.aspx?ID=7";
img.visible = true;

The LoadPhoto.aspx has no HTML just the 'Page, AutoEventWireup,
CodeFile,Inherits' as specified for this technique. The codebehind for
LoadPhoto.aspx.cs has the Page_Load event where it gets the jpeg data and
calls Response.ContentType = "image/jpeg" then Response.BinaryWrite( calls
function that returns byte[] array from database).

I cannot get this to work. Also, I put in some code into LoadPhoto.aspx.cs
to populate a session varible just to see if this Page-Load is firing. The
session variable does not get populated, so, it seems that all this code
doesn't even execute.

Can someone help me out?

Thanks,
Joe


 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      05-11-2006
This might help:

http://staff.develop.com/ballen/blog...8-9aff48bf2481

-Brock
http://staff.develop.com/ballen


> Hi All,
>
> Using vs2005, C#, SQL Server 2005/Shared Environment.
>
> I'm attempting to populate an image control from a jpeg stored in a
> image field in sql server. Tried using both HTML image and ASP image
> - can't get either to work.
>
> I'm basically using the technique outlined in the ASP.NET 2.0 Cookbook
> (OReilly).
>
> So, in my page that has the image controls the code in the view photo
> button event is
>
> img.Src = "LoadPhoto.aspx?ID=7";
> img.visible = true;
> The LoadPhoto.aspx has no HTML just the 'Page, AutoEventWireup,
> CodeFile,Inherits' as specified for this technique. The codebehind
> for LoadPhoto.aspx.cs has the Page_Load event where it gets the jpeg
> data and calls Response.ContentType = "image/jpeg" then
> Response.BinaryWrite( calls function that returns byte[] array from
> database).
>
> I cannot get this to work. Also, I put in some code into
> LoadPhoto.aspx.cs to populate a session varible just to see if this
> Page-Load is firing. The session variable does not get populated, so,
> it seems that all this code doesn't even execute.
>
> Can someone help me out?
>
> Thanks,
> Joe



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com Computer Information 0 09-26-2012 09:40 AM
Display Image from Database in Image Control chrispragash@hotmail.com ASP .Net 1 10-18-2006 01:48 PM
Dynamic Image from Database (Post 2) Joe Reiss ASP .Net Web Controls 3 05-11-2006 06:31 PM
Display Image from Database in an Image control chrispragash@hotmail.com ASP .Net Web Services 1 08-25-2005 07:38 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57