www.webdeveloper.com
Results 1 to 2 of 2

Thread: ASP:Repeater help

  1. #1
    Join Date
    Aug 2005
    Posts
    38

    ASP:Repeater help

    Currently, i am using a asp:repeater to bind my images from database to a imagebutton. For example, i have 2 images in the database. Therefore, the repeater should have generate 2 imagebuttons for me. And each imagebutton is suppose to show 2 different images.

    Somehow both imagebuttons are displaying the same images, which always happens to be the 2nd image. Before the itemdatabound, i already databind it to an arraylist. The imgRetrieve.aspx is used to retrieve/display image for me based on the id passed in. Any help is greatly appreciated.

    Code:
    <asp:repeater id="repImages" runat="server" OnItemDataBound="repImages_ItemDataBound">
    		<ItemTemplate>
    			<asp:ImageButton runat="server" ID="imgItem" CssClass="removeBorder" onmouseover="this.className='applyBorder'"
    				onmouseout="this.className='removeBorder'" Width="100" Height="100" OnClick="imgItem_Click" />
    			<br>
    		</ItemTemplate>
    	</asp:repeater>
    Code:
        Protected Sub repImages_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles repImages.ItemDataBound
    
    Dim Item As RepeaterItem = CType(e.Item, RepeaterItem)
            Dim MyImage As New ImageButton
    MyImage = CType(Item.FindControl("imgItem"), ImageButton)
    dim index as integer=0
    for index=0 to imgArrList.count-1
    MyImage.ImageUrl = "..\imgRetrieve.aspx?id=" & imgArrList.item(index).staffid
    end next

  2. #2
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles