AJ0718
asked on
Repeater ItemDataBound Skipping First Record
My repeater is generally working well but for some reason is skipping the data binding to a control for the first item in the repeater. The code seems pretty straightforward to me but I am obviously missing something. Can one of you experts help?
Protected Sub rptGrants_ItemDataBound(sender As Object, e As RepeaterItemEventArgs)
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
Dim GrantID As HiddenField = DirectCast(e.Item.FindControl("hfGrantID"), HiddenField)
Dim iz As ImageZoom = DirectCast(e.Item.FindControl("ImageZoom1"), ImageZoom)
Dim cm As New SqlCommand("PBR_SelectGrantPhotos", cn)
cm.CommandType = CommandType.StoredProcedure
cm.Parameters.Add("@GrantID", SqlDbType.Int).Value = GrantID.Value
Try
cn.Open()
Dim izda As New SqlDataAdapter(cm)
Dim izds As New DataSet
izda.Fill(izds)
iz.DataSource = izds
iz.DataBind()
Catch ex As Exception
Finally
cn.Close()
End Try
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER