This error has been a real pain to deal with. I finally have a work around and a guess at the underlying problem, and because I see that people are having this same problem I thought I would do a little writeup about it.
Obviously, if you look at the actual error message, there are cases when you can get this message and the problem is easy to solve. e.g. you have a dropdown populated with EmploID values and you try to databind with: Value='<%# Bind("EmployeeName") %>
'**** In my populate method Me.LocationsDropdown.DataSource = LocationAdapter.LocationsToAdapters(locations) Me.LocationsDropdown.DataTextField = "LocationDescriptionWithActiveAttribute" Me.LocationsDropdown.DataValueField = "LocationId" Me.LocationsDropdown.DataBind()'*************************************'************************************* Private Class LocationAdapter Public ciLocationId As Integer Public csLocationDescriptionWithActiveAttribute As String Public Property LocationId() As Integer Get Return ciLocationId End Get Set(ByVal value As Integer) Me.ciLocationId = Value End Set End Property Public Property LocationDescriptionWithActiveAttribute() As String Get Return csLocationDescriptionWithActiveAttribute End Get Set(ByVal value As String) Me.csLocationDescriptionWithActiveAttribute = Value End Set End Property Public Sub New(ByVal loc As Location) Me.LocationId = loc.LocationId Me.LocationDescriptionWithActiveAttribute = loc.LocationDescriptionWithActiveAttribute End Sub Public Sub New(ByVal Id As Integer, ByVal Desc As String) Me.LocationId = Id Me.LocationDescriptionWithActiveAttribute = Desc End Sub Public shared Function LocationsToAdapters(ByVal locations As List(Of Location)) As List(Of LocationAdapter) Dim adapters As New List(Of LocationAdapter) adapters.Add(New LocationAdapter(0, "--Location")) For Each loc As Location In locations adapters.Add(New LocationAdapter(loc)) Next Return adapters End Function End Class
Remember Me
Powered by: newtelligence dasBlog 1.9.6264.0
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
E-mail
Theme design by Jelle Druyts