Click here to Skip to main content
15,916,293 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Question.Net Membership provider Pin
anandhakrishnan4-Jun-09 3:03
anandhakrishnan4-Jun-09 3:03 
Questionrepeater control in ASP.Net with C# Pin
mahichandu4-Jun-09 3:02
mahichandu4-Jun-09 3:02 
AnswerRe: repeater control in ASP.Net with C# Pin
Manas Bhardwaj4-Jun-09 3:30
professionalManas Bhardwaj4-Jun-09 3:30 
QuestionRe: repeater control in ASP.Net with C# Pin
mahichandu4-Jun-09 3:45
mahichandu4-Jun-09 3:45 
AnswerRe: repeater control in ASP.Net with C# Pin
Niladri_Biswas1-Jul-09 5:57
Niladri_Biswas1-Jul-09 5:57 
AnswerRe: repeater control in ASP.Net with C# Pin
Niladri_Biswas4-Jun-09 19:25
Niladri_Biswas4-Jun-09 19:25 
QuestionListBox DataValueField Pin
Koss_G4-Jun-09 1:51
Koss_G4-Jun-09 1:51 
Questionhow to handle in code to remove security dialoag in IE 6 in C#? Pin
anish27patel4-Jun-09 1:42
anish27patel4-Jun-09 1:42 
AnswerRe: how to handle in code to remove security dialoag in IE 6 in C#? Pin
Manas Bhardwaj4-Jun-09 3:32
professionalManas Bhardwaj4-Jun-09 3:32 
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 

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.