You should be using an ImageButton instead of an image and wiring to the Click event. The ImageUrl property just tells the server where to find the image to display.
Main Topics
Browse All TopicsI have a page called DisplayImage and within
the page_load event i was able to retrieve some
values from the query string
ddum = person.Id;
ltrName.Text = person.Name;
ltrEmail.Text = person.Emailaddress;
ltrPhone.Text = person.Telephone;
However i want to pass the value of ddum
to another page to run a process and return a byte image
<asp:Image ID="studentImage" runat="server" ImageUrl="~/RetrieveImage.
<asp:Literal ID="ltrName" runat="server"></asp:Liter
<asp:Literal ID="ltrEmail" runat="server"></asp:Liter
<asp:Literal ID="ltrPhone" runat="server"></asp:Liter
How can I pass the value of ddum as a parameter to my Imageurl
so that i can use it to retrieve my image.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Thanks Nash2334. Looks like you are very close. I will explain my situation. I have a gridview which has a column as hyperlink. when you click on a link it will grab corresponding information on the row and pass it as a querystring to the next page "displayimage.aspx".
In dislayimage.aspx, I already have 3 values from the querystring which I am displaying as labels. I now want it to fetch a picture from another page (4th value) while the display.aspx loads.
There will be no button to click so I cannot use an image button. the picture should be loaded when the displayimage pages loads.
I hope this is clear.
Thanks.
How does RetrieveImage.aspx retrieve the image? As a binary? Does it simply embed it in its own markup?
You've got two options here:
1. Put RetrieveImage.aspx with an asp:Image in an iframe in your displayimage.aspx, then load the ImageUrl in the Page_Load of RetrieveImage.aspx.
2. Ditch RetrieveImage.aspx altogether and process the image retrieval in displayimage.aspx itself.
I'm not sure what purpose RetrieveImage.aspx is playing here, and why whatever logic it is processing can't be put directly into displayimage.aspx.
Thanks. This is the way the image is been returned.
byte[] Imageset = oDoc.GetPhoto(person.Id, sStudentPhotoDocType);
if (Imageset != null)
{
Response.Buffer = true;
Response.ContentType = "Image/JPEG";
Response.BinaryWrite(Image
}
I wasnt sure you could use Response in a class library. Are you suggesting I put this in a class library and now return this to the image control
thanks again for your response Nash2334. I just tried doing this using a class library and I received errors with response.buffer etc. There is no response in the intellisence.
How can i deal with this?
byte[] Imageset = oDoc.GetPhoto(person.Id, sStudentPhotoDocType);
if (Imageset != null)
{
Response.Buffer = true;
Response.ContentType = "Image/JPEG";
Response.BinaryWrite(Image
}
>>I just tried doing this using a class library and I received errors with response.buffer etc. There is no response in the intellisence.
>>The snippet you provide is fine.
Response doesn't work directly in a class file because it is a part of the HttpContext class.
When you try to put Response in a class file that doesn't inherit from the HttpContext class or Page class, it's going to error out.
Even when you inherit from the needed class in your class, you'll face the problem that, as a class file, the class doesn't "know" what the current HttpContext is (the calling web page).
You can get around the error by using:
HttpContext.Current.Respon
but, even as a class function, you'll still be faced with the same problem of Response in that when you call your function from your web page, it's going to create the image at the top of the page.
All you did by putting it in a class file is take the code off the web page, you won't be fixing the real problem you're having (as SirDots posted in 2 other questions) of being able to place the binary-generated image in a specific position above 2 labels.
To do that, you need the RetrievImage.aspx page (or a similar functioning ashx page) to use as the ImageUrl (as posted in the other 2 questions)
As to the original question:
How can I pass the value of ddum as a parameter to my Imageurl
so that i can use it to retrieve my image.
If you make ddum a public variable, on the aspx, you can call it directly with:
<asp:Image ID="studentImage" runat="server" ImageUrl=~/RetrieveImage.a
Business Accounts
Answer for Membership
by: burakiewiczPosted on 2008-05-28 at 10:03:14ID: 21662190
you could put a placeholder and dynamically create the image then you can get the info from the querystring, or put it in a hidden field and use javascript to change the src