I'm using a class to create a list of items to show in a repeater. I'm getting an error saying "No default member found for type <Type>" when I try to use a DataItem in OnItemDataBound event.
BOL
My Repeater:-Code:Public Class PolicyCommList Inherits List(Of PolicyCommissionBOL) Public Sub New() End Sub Private _page_error As String = String.Empty Public Property page_error() As String Get Return _page_error End Get Set(ByVal value As String) _page_error = value End Set End Property End Class Public Class PolicyCommissionBOL Private _introducer As String = String.Empty Public Property introducer() As String Get Return _introducer End Get Set(ByVal value As String) _introducer = value End Set End Property End Class
Binding the repeaterCode:<asp:repeater ID="dlst_comm" runat="server" OnItemDataBound="dlst_comm_onitemdatabound">
OnItemDataBoundCode:Dim commlist As PolicyCommList = CommBLL.GetCommList(PolicyDetails.policyref) If Not IsNothing(commlist) Then dlst_comm.DataSource = commlist dlst_comm.DataBind() Else lbl_nocomm.Visible = True End If
When I load the page I get this error:-Code:Protected Sub dlst_comm_onitemdatabound(ByVal s As Object, ByVal e As RepeaterItemEventArgs) If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then Dim img_intro As Image = e.Item.FindControl("img_introducer") If Not String.IsNullOrEmpty(e.Item.DataItem("introducer")) Then img_intro.Visible = True End If End Sub
System.MissingMemberException: No default member found for type 'PolicyCommissionBOL'.
on line:-
I can't see why there wouldn't be a value for introducer. Any ideas how I can fix this error?Code:If Not String.IsNullOrEmpty(e.Item.DataItem("introducer")) Then img_intro.Visible = True
Thanks



LinkBack URL
About LinkBacks
Reply With Quote
I could do with something to eat myself!!

Bookmarks