Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with an imagebutton

Status
Not open for further replies.

jcapra

Programmer
Mar 25, 2008
2
US
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
[color]
This is my 4 web site and no luck so any help is greatly appreciated.

Thanks

John
 
Well I want page visitor to be able to click on the imagebutton and have it redirected to enlarged image page and that is part that does not work. I was able to make it happen with a link button no problem but with the imagebutton is just reloads the page.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top