Need help with an imagebutton

jcapra

New member
Joined
Mar 25, 2008
Messages
1
Location
New Jersey
Programming Experience
1-3
Hello,
I am trying to create thumbnails with a datalist. I have the urls of each image stored in a database (images are on a seperate server). I have the URL binded to the imageurl of the imagebutton and I added itemcommand code that will redirect to original image. For some reason it does not work. I was able to get it to work with a linkbutton and when I try to do it with a hyperlink it does not maintain the height and width (the images appears as the original size) set.

Here's the asp code:
<asp:datalist id="dlPics" runat="server" RepeatDirection="Horizontal" RepeatColumns="10" OnItemCommand="ViewPhotos">
<ItemTemplate>
<asp:ImageButton id=ibtnPics runat="server" Width="75px" Height="50px" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "AllPhotos") %>' ToolTip="Click to Enlarge" CommandName="item">
</asp:ImageButton>
</ItemTemplate>
</asp:datalist>


Here's the code behind.

Protected Sub ViewPhotos(ByVal sender As Object, ByVal e As DataListCommandEventArgs)
Dim imgINDPhotos As ImageButton = CType(e.Item.FindControl("ibtnPics"), ImageButton)
Dim photoUrl As String = imgINDPhotos.ImageUrl.ToString ' = CType(e.Item.FindControl("ibtnPhotos"), ImageButton).ImageUrl
Response.Redirect(photoUrl)
End Sub


Any help is greatly appreciated.

Thanks

John
 
Back
Top