This is driving me insane! Done this many times as a .Net developer but can't seem to get it working in a SharePoint webpart.
Page load code...
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 the repeater code
Protected Sub rptCarousel_ItemDataBound(source As Object, e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles rptCarousel.ItemDataBound Dim litTitle As Literal Dim drv As DataRowView 'Now add this record to the datarow drv = DirectCast(e.Item.DataItem, DataRowView) 'Find and initialise our elements litTitle = DirectCast(e.Item.FindControl("litTitle"), Literal) 'Now set our values litTitle.Text = drv("Title").ToString() End Sub
Once i have deployed the webpart is running ok, its finding the SP list and it knows I have 3 items in my list (from the DIV's that are displaying by viewing source) but it will not display the data...is there any other way to debug this?
WOW! Please ignore my stupidness! would help i had some content in my title eh?! The above works if anyone wants to use it.
However I need to display image but cant convert the Object to an image?