I am creating a sandboxed webpart which display a list from my SP. I have the following code
ASCX page...
<asp:Repeater ID="rptCarousel" runat="server" >
<ItemTemplate>
<div>
<div class="sliderstuff">
<asp:Image ID="imgCarousel" runat="server" />
<h2><asp:Literal ID="litTitle" runat="server" /></h2>
<h3><asp:Literal ID="litDescription" runat="server" /></h3>
<div class="btnSlider">
<a href="#" ><asp:Literal ID="litLinktext" runat="server" /></a>
</div>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
Then my code behind
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Using site As New SPSite("http://cn-lap-hp-dev/")
Using web As SPWeb = site.OpenWeb()
Dim Imagelist As SPList = web.Lists("Home Page Carousel")
rptCarousel.DataSource = Imagelist.Items.GetDataTable()
rptCarousel.DataBind()
End Using
End Using
End Sub
and
Protected Sub rptCarousel_ItemDataBound(ByVal sender As Object, ByVal e As RepeaterItemEventArgs) Handles rptCarousel.ItemDataBound
Dim litTitle As Literal
Dim item As SPListItem = DirectCast(e.Item.DataItem, SPListItem)
'Find and initialise our elements
litTitle = DirectCast(e.Item.FindControl("hypCompetitionID"), Literal)
'Now add this record to the datarow
litTitle.Text = "Test"
End Sub
Pretty simple i think but I cannot get the webpart to work when deployed...if i remove the "Handles rptCarousel.ItemDataBound" the webpart renders but with no data?? Anyone any ideas?
S