![]() |
| |||||||
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
| ||||
| 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 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
Code: <asp:repeater ID="dlst_comm" runat="server" OnItemDataBound="dlst_comm_onitemdatabound"> Code: 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
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:- Code: If Not String.IsNullOrEmpty(e.Item.DataItem("introducer")) Then img_intro.Visible = True
Thanks Last edited by richyrich; July 9th, 2008 at 08:07 AM. |
| Sponsored Links |
| ||||
| RR From what I've found, the error seem to be unique to VB.NET and occurs during late binding events -- like databinding in a Repeater. I'm thinking the problem is in you ItemTemplate control and that the Repeater has no idea what property to bind to. Take a look at this MSDN article for info on this error; http://msdn.microsoft.com/en-us/library/zzh9ha57(VS.80).aspx. Also, if you could post your ItemTempate code, we should get this sorted.
__________________ Wolffy ------------------------ Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Rework for your specific environment may be required. Void where prohibited by law. Not valid in California. Your mileage may vary. |
| The Following User Says Thank You to Wolffy For This Useful Post: | ||
richyrich (May 29th, 2008) | ||
| ||||
| 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")
Dim myIntroducer As PolicyCommissionBOL = e.Item.DataItem
If Not String.IsNullOrEmpty(myIntroducer.introducer) Then
img_intro.Visible = True
End If
End If
End Sub
__________________ jmurrayhead Did I help you out? Make me popular by clicking the icon!If you found a post helpful, please click the button in the lower right-hand corner of the post.Powered by ASP.Net |
| The Following User Says Thank You to jmurrayhead For This Useful Post: | ||
richyrich (May 29th, 2008) | ||
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Webform Default Button | Devwhiz | .Net Development | 9 | May 15th, 2008 01:15 PM |
| Southpark Member Pics | AOG123 | Off-Topic Discussion | 7 | May 14th, 2008 01:43 PM |
| Computer \\COMPUTERNAME cannot be managed. The network path was not found. | jmurrayhead | Microsoft Windows | 0 | April 25th, 2008 06:43 PM |
| Sponsored Links |
| ASP.NET Resource Index a directory of ASP.NET tutorials, applications, scripts, assemblies and articles for the novice to professional developer. Free Web Directory Including Chats and Forums Resources, Offer automatic, instant and free directory submissions. | URLZ Web Directory URLZ Web Directory Free Web Directory - Add Your Link The Little Web Directory | Free Web Directory Pegasus free web directory is a free directory organised by categories. Web Directory & SEO Services dirroot web directory |