AspdotnetCodes.com
Search
Articles
Books
Resources
Asp.Net News
Downloads
Free Tech Magazines
Asp.Net Web Hosting
Archives
Softwares
Newsletter
Suggest Us
Link to Us
Feeds Subscription
Articles
Questions & Answers
Tips & Tricks
 Gridview
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

http://www.aspdotnetcodes.com/Asp.Net_Dynamic_Thumbnail_Creation.aspx

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.

Thanks.
 
hyperlink image in gridview
Answered By Raman Pundir on 3/9/2009 2:49:15 AM
hi
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>
</asp:HyperLink>

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 it.so 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
No Nonsense XML Web Development With PHP - Free 146 Page Preview!
The ASP.NET 2.0 Anthology: 101 Essential Tips, Tricks & Hacks - Free 156 Page Preview
Website Magazine