0

Good morning,
I am trying to pass an image from one page to another and having some difficulty. The page its is on is called Spain.aspx, it show Spanish football jerseys, it has a images in a gridview, i want users to be able to click on this any jersey and get redirected to a page called ProductLarge where it will display the jersey they clicked and show it on a much larger scale. I have read around and tried some different methods but the closet i seem to be is with the below code:

<asp:Image ID="productimage" runat="server" ImageUrl='<%# "~/Handler.ashx?productid=" + Eval("productid")%>' Width="100" Height="100" />

or

<asp:HyperLink Font-Size="12px" ID="lnkImage" runat="server" 
ImageUrl='<%# "~/Handler.ashx?productid=" + Eval("productid")%>'
NavigateUrl='<%#"ProductLarge.aspx?productid=" + Eval("productid")%>'>
<a href ="ProductLarge.aspx" > </a> </asp:HyperLink>

Would anyone have advice, being new to this should i use a Handler(in your opinion), or be trying to use alternative methods for passing an image? Any help appreciated,

Edited by __avd: Wrong forum

3
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by Gaving30
0

Could you not store which image is selected in a Session? and then pull up the correct image on the next page using the session value?

(don't do much ASP.Net work so cant remember if this works)

Edited by Mike Askew

1

You're passing productid to ProductLarge.aspx as QueryString and rendering an image via handler so you need to request the handler with productid in ProductLarge.aspx.

<asp:HyperLink 
          ID="lnkImage" runat="server" 
          ImageUrl='<%# Eval("productid","~/Handler.ashx?productid={0}") %>'
          NavigateUrl='<%# Eval("productid","ProductLarge.aspx?productid={0}")' />

and markup in ProductLarge.aspx should be,

<img src='Handler.ashx?productid=<%=Request["productid"] %>' alt='Large Image' />
0

Thank you AVD i was not requesting the Handler in my ProductLarge page correctly, but thanks to you i now am.....

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.