Asp.Net News
Free Tech Magazines
Asp.Net Web Hosting
Suggest Us
Link to Us
Feeds Subscription
Questions & Answers
Tips & Tricks
Posted by Raman Pundir on  3/5/2009 1:52:06 AM Category: Asp.Net 2.0
Add to my favorites
Email to friend
hi all
i m using gridview control in my application. i need to show image with hyperlink on it and i want to pass the id of image to next page as querystring. images are stored in database.

any kind of help will be appreciated highly,
thanx in advance...

Post Your Reply Post New Question

 Viewer's Reply
Simply place an Anchar Tag
Answered By Moderator1 on 3/7/2009 1:57:34 AM
Do the same way as in our article

and place an anchor tag with the image control inside it.

<a href="http://localhost/yourside.aspx?imgid=1"><img src=’ImageHandler.ashx?PhotoID=<%# Eval(“ImgID”)%>’/></a>

The above code is just an sample. Please check the syntax.

hyperlink image in gridview
Answered By Raman Pundir on 3/9/2009 2:49:15 AM
here is the code to pass id for each image in a gridview control.

<asp:HyperLink id="hrefFrom" runat="server" NavigateUrl='<%# Eval("SenderID","~/Users/ProfileView.aspx?UID={0}") %>'>
<asp:Image id="imgSender" Width="80px" Height="90px" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "Image") %>' ></asp:Image>

check it out
sending the id of the selected image in gridview
Answered By supriya upadhyay on 6/15/2009 8:23:46 AM
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
Dim row As GridViewRow = GridView1.SelectedRow
Dim imageid As String = row.Cells(1).Text
Server.Transfer("~/Default.aspx?imageid=" & imageid)
End Sub

save the image id in the first column of the gridview and hide that u can only get the id of the image but user can not see it
Post Your Reply If you still have problem, post it again under this reply for better response.

Sponsored by
Sexy Web Design - Free 71 Page Preview!
Take Advantage of Oracle's 2 Day DBA Course
Introduction to Software Development