Click here to Skip to main content
15,886,963 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionoutlook to database...? Pin
koolprasad20034-Jun-09 0:59
professionalkoolprasad20034-Jun-09 0:59 
AnswerRe: outlook to database...? Pin
Abhijit Jana4-Jun-09 1:18
professionalAbhijit Jana4-Jun-09 1:18 
QuestionRM Files Pin
hadad4-Jun-09 0:39
hadad4-Jun-09 0:39 
Questionhow to open msn messenger..... Pin
bhuraasif4-Jun-09 0:36
bhuraasif4-Jun-09 0:36 
AnswerRe: how to open msn messenger..... Pin
Christian Graus4-Jun-09 11:48
protectorChristian Graus4-Jun-09 11:48 
AnswerRe: how to open msn messenger..... Pin
RichardGrimmer5-Jun-09 0:53
RichardGrimmer5-Jun-09 0:53 
Questionset binary image in Image web control. Pin
andiyuniar4-Jun-09 0:26
andiyuniar4-Jun-09 0:26 
AnswerRe: set binary image in Image web control. Pin
Ryomin4-Jun-09 5:55
professionalRyomin4-Jun-09 5:55 
Hi andiyuniar
I've had this issue before. The way I handled it was to "spoof" a content page to change it's ContentType to display images. I would pass it an id via query string and then set the imageurl to the spoofed page.

Here's an example that should help you. Please keep in mind, I don't know if it's the best solution, but it works for me. Also, there could be some performance hits if you have too many images being loaded on your page via this method.

Create a WebForm... i called mine LoadImage.aspx
Place this code in the Load event

if (Request.QueryString["Id"] != null)
        {
            int Id = Convert.ToInt32(Request.QueryString["Id"].ToString());
            byte[] image = null;
            //You will have to add your connection information and grab the image from the database
            // ToDo: Load binary image into image variable;

                if (image!=null)
                {
                    MemoryStream ms = new MemoryStream(image);
                    Bitmap b = new Bitmap(Image.FromStream(ms));

                    Response.ContentType = "image/jpeg";
                    b.Save(Response.OutputStream, ImageFormat.Jpeg);
                }
                else
                {
                    Bitmap b = new Bitmap(Image.FromFile(Server.MapPath("images/noimage.png")));

                    Response.ContentType = "image/jpeg";
                    b.Save(Response.OutputStream, ImageFormat.Jpeg);
                }
        }
        else
        {
            Bitmap b = new Bitmap(Image.FromFile(Server.MapPath("images/noimage.png")));

            Response.ContentType = "image/jpeg";
            b.Save(Response.OutputStream, ImageFormat.Jpeg);
        }


Then on the page you want to bind your image to just set the ImageUrl property to the webform plus query string.

Image1.ImageUrl = "LoadImage.aspx?Id=1";


Happy Coding

Cheers

Disgyza
Programmer Analyst

GeneralRe: set binary image in Image web control. Pin
andiyuniar4-Jun-09 16:18
andiyuniar4-Jun-09 16:18 
QuestionJQuery AJax Problem Pin
Jagz W3-Jun-09 23:38
professionalJagz W3-Jun-09 23:38 
AnswerRe: JQuery AJax Problem Pin
Christian Graus3-Jun-09 23:53
protectorChristian Graus3-Jun-09 23:53 
Questionusing timer to refresh gridview Pin
Arif Liminto3-Jun-09 22:53
professionalArif Liminto3-Jun-09 22:53 
AnswerRe: using timer to refresh gridview Pin
K03063-Jun-09 23:05
K03063-Jun-09 23:05 
GeneralRe: using timer to refresh gridview Pin
Christian Graus3-Jun-09 23:27
protectorChristian Graus3-Jun-09 23:27 
AnswerRe: using timer to refresh gridview Pin
Christian Graus3-Jun-09 23:28
protectorChristian Graus3-Jun-09 23:28 
AnswerRe: using timer to refresh gridview Pin
Brian W King4-Jun-09 2:20
Brian W King4-Jun-09 2:20 
QuestionCheck Box as Toggle Pin
CodingLover3-Jun-09 20:54
CodingLover3-Jun-09 20:54 
AnswerRe: Check Box as Toggle Pin
Christian Graus3-Jun-09 21:00
protectorChristian Graus3-Jun-09 21:00 
AnswerRe: Check Box as Toggle Pin
Brian W King4-Jun-09 2:33
Brian W King4-Jun-09 2:33 
Questionjavascript for disable back button Pin
Kissy163-Jun-09 20:53
Kissy163-Jun-09 20:53 
AnswerRe: javascript for disable back button Pin
Christian Graus3-Jun-09 21:00
protectorChristian Graus3-Jun-09 21:00 
AnswerRe: javascript for disable back button Pin
Jay Royall3-Jun-09 22:33
Jay Royall3-Jun-09 22:33 
GeneralRe: javascript for disable back button Pin
Kissy163-Jun-09 23:00
Kissy163-Jun-09 23:00 
GeneralRe: javascript for disable back button Pin
Jay Royall3-Jun-09 23:28
Jay Royall3-Jun-09 23:28 
GeneralRe: javascript for disable back button Pin
Christian Graus3-Jun-09 23:36
protectorChristian Graus3-Jun-09 23:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.