ASP:Repeater help

windows

Guest
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.


<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>



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 nextMoved to .NET
 
Back
Top