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,

Recommended Answers

All 3 Replies

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)

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' />

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.