Re: Error : Complex DataBinding accepts as a data source either an IList or an IListSource

From: Jan Tielens (jan_at_no.spam.please.leadit.be)
Date: 05/20/04


Date: Thu, 20 May 2004 10:46:27 +0200

It seems you are using custom classes, maybe this article explains your
problem:
http://www.microsoft.com/belux/nl/msdn/community/columns/jtielens/webservicewrapper.mspx

-- 
Greetz
Jan
________________
Read my weblog: http://weblogs.asp.net/jan
"BS" <lbs@nospam.com> schreef in bericht
news:eP2bVKOPEHA.3044@TK2MSFTNGP10.phx.gbl...
> Hello Jan
> thank you for trying to help me on this one.
> We did not write the webservice.
>
> Here are the definition of some of the functionality that can be called.
>
> --------------------------------------------------------------------------
--
> ---------------------------------------------------------
> '<remarks/>
>
>
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.XXXXXX.c
> om/integration/2.0")> _
>
> Public Class responseHistoricalData
>
> Inherits LegacyApiOutput
>
>
> '<remarks/>
>
> <System.Xml.Serialization.XmlElementAttribute("historicalData")> _
>
> Public historicalData() As historicalData
>
> End Class
> --------------------------------------------------------------------------
--
> ---------------------------------------------------------
>
> '<remarks/>
>
>
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.XXXXXX.c
> om/integration/2.0")> _
>
> Public Class historicalData
>
>
> '<remarks/>
>
> Public equipmentID As String
>
>
> '<remarks/>
>
> Public terminalID As String
>
>
> '<remarks/>
>
> Public arrivalTimestamp As String
>
>
> '<remarks/>
>
> Public position As positionAndProximityWithTimestamp
>
>
> '<remarks/>
>
> Public serviceMeterHours As serviceMeterHoursWithTimestamp
>
> End Class
>
>
>
> --------------------------------------------------------------------------
--
> ---------------------------------------------------------
>
> '<remarks/>
>
>
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.XXXXXX..
> com/integration/2.0")> _
>
> Public Class positionAndProximityWithTimestamp
>
> Inherits positionWithTimestamp
>
>
> '<remarks/>
>
> <System.Xml.Serialization.XmlElementAttribute("proximity")> _
>
> Public proximity() As proximity
>
> End Class
>
> --------------------------------------------------------------------------
--
> ---------------------------------------------------------
>
>
>
> '<remarks/>
>
>
<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.XXXXXX..
> com/integration/2.0")> _
>
> Public Class proximity
>
>
> '<remarks/>
>
> Public type As proximityType
>
>
> '<remarks/>
>
> Public location As String
>
>
> '<remarks/>
>
> Public [region] As String
>
>
> '<remarks/>
>
> Public postalCode As String
>
>
> '<remarks/>
>
> <System.Xml.Serialization.XmlElementAttribute("kilometersFromLocation",
> GetType(System.Decimal)), _
>
> System.Xml.Serialization.XmlElementAttribute("milesFromLocation",
> GetType(System.Decimal)), _
>
> System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemElementName")>
_
>
> Public Item As Decimal
>
>
> '<remarks/>
>
> <System.Xml.Serialization.XmlIgnoreAttribute()> _
>
> Public ItemElementName As ItemChoiceType1
>
>
> '<remarks/>
>
> Public directionFromLocation As proximityDirection
>
> End Class
>
>
>
> --------------------------------------------------------------------------
--
> ---------------------------------------------------------
>
>
>
> If I create a "buffer class" called HistoDate which stores lets say just 3
> properties as string and I loop thru each records (for this sample..only
> 20), then I do not have a problem either. But there must be a better way
> than to "duplicate" the webservice response ?
>
>
> (
> Public Class HistoData
>
> Private _equipmentID As String = ""
>
> Private _serviceMeterHours As String
>
> Private _terminalID As String
>
> The Gets & Sets as string here.....
>
> )
>
>
> Dim wsResult(20) As HistoData
>
> For i = 0 To oResponse.historicalData.Length - 1
>
> Dim c1 As New HistoData
>
> c1.equipmentID = oResponse.historicalData(i).equipmentID
>
> c1.serviceMeterHours =
>
DisplayHour_FromUnsignedDuration(oResponse.historicalData(i).serviceMeterHou
> rs.value)
>
> c1.terminalID = oResponse.historicalData(i).terminalID
>
> 'wsResult = New HistoData() {c1} 'Create an array of customers
>
> wsResult(i) = c1 'Create an array of customers
>
> If i = 20 Then
>
> Exit For
>
> End If
>
> Next i
>
> extendedDataGrid1.DataSource = wsResult
>
> ExtendedDataGridTableStyle1.MappingName = wsResult.GetType().Name
>
> =========================================
>
> I tried to partially use your "custom made classs through a webservice",
but
> I could not figure out how to change the HeaderText of some columns in the
> grid. I would somehow need to do that "on the fly", since this will be a
> multi-langual application.
>
>
> I also try to build the grid with datatable, datarow..etc, but then I can
> only use textbox columns...which is not good enough for our users.
>
> Thank you for all your help.
>
> Regards
>
>
>
>
> "Jan Tielens" <jan@no.spam.please.leadit.be> wrote in message
> news:%23ZOZknJPEHA.1644@TK2MSFTNGP09.phx.gbl...
> > Can you post the definition of your web service itself also? Are you
> working
> > with DataSets or custom classes?
> > -- 
> > Greetz
> > Jan
> > ________________
> > Read my weblog: http://weblogs.asp.net/jan
> >
> >
> > "BS" <lbs@nospam.com> schreef in bericht
> > news:ebPSqZFPEHA.2864@TK2MSFTNGP12.phx.gbl...
> > > Hello everybody
> > >
> > > I'm calling a webservice that returns complex data.
> > > The goal is to populate a datagrid with it.
> > >
> > > Using a loop for each record found ( such as For i = 0 To
> > > oResponse.historicalData.Length - 1 )
> > > no problem to load a datagrid.
> > >
> > > However, when I try to bind directly the datasource to the web service
> > > complex datatype, I have the following error:
> > > Complex DataBinding accepts as a data source either an IList or an
> > > IListSource
> > >
> > > Any idea what I have to do to the webservice records in order for my
> > > datagrid to load ?
> > >
> > >
> > > Here is the code used to pupulate the grid.
> > >
> > > Dim oES As SomeWebservice.EquipmentService = New
> > > SomeWebservice.EquipmentService
> > > Dim oResponse As SomeWebservice.responseHistoricalData = New
> > > SomeWebservice.responseHistoricalData
> > >
> > >
> > > 'set response object with service response
> > > oResponse = oES.historicalData(oRequest)
> > >
> > > DataGrid1.DataSource = oResponse
> > >
> > >
> >
> >
>
>


Relevant Pages