By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,036 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,036 IT Pros & Developers. It's quick & easy.

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

P: n/a
BS
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

Nov 20 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Hi,

You can an arraylist, collection, or array to a datagrid. Any
poperties in a class contained in class stored in one of the above will be
shown in the datagrid. What format are you getting you data in?

Ken
------------------
"BS" <lb*@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.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

Nov 20 '05 #2

P: n/a
BS
Hello
I posted a "short" version of the definition on the "webservice" newsgroup.

http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

Thank you for your help
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
Hi,

You can an arraylist, collection, or array to a datagrid. Any
poperties in a class contained in class stored in one of the above will be
shown in the datagrid. What format are you getting you data in?

Ken
------------------
"BS" <lb*@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.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


Nov 20 '05 #3

P: n/a
Hi,

What is the format of this. I need to know more about
responseHistoricalData

Dim oResponse As SomeWebservice.responseHistoricalData = New
SomeWebservice.responseHistoricalData

Ken
--------------
"BS" <lb*@nospam.com> wrote in message
news:O9**************@TK2MSFTNGP09.phx.gbl...
Hello
I posted a "short" version of the definition on the "webservice"
newsgroup.

http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

Thank you for your help
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
Hi,

You can an arraylist, collection, or array to a datagrid. Any
poperties in a class contained in class stored in one of the above will
be
shown in the datagrid. What format are you getting you data in?

Ken
------------------
"BS" <lb*@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.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
>
>
>



Nov 20 '05 #4

P: n/a
BS
Here is the definitions: They are most of the time "complex data type".

----------------------------------------------------------------------------
---------------------------------------------------------
'<remarks/>

<System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://www.XXXXXX.c
om/integration/2.0")> _

Public Class responseHistoricalData

Inherits LegacyApiOutput
'<remarks/>

<System.Xml.Serialization.XmlElementAttribute("his toricalData")> _

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("pro ximity")> _

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("kil ometersFromLocation",
GetType(System.Decimal)), _

System.Xml.Serialization.XmlElementAttribute("mile sFromLocation",
GetType(System.Decimal)), _

System.Xml.Serialization.XmlChoiceIdentifierAttrib ute("ItemElementName")> _

Public Item As Decimal
'<remarks/>

<System.Xml.Serialization.XmlIgnoreAttribute()> _

Public ItemElementName As ItemChoiceType1
'<remarks/>

Public directionFromLocation As proximityDirection

End Class

----------------------------------------------------------------------------
---------------------------------------------------------



"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uM**************@TK2MSFTNGP10.phx.gbl...
Hi,

What is the format of this. I need to know more about
responseHistoricalData

Dim oResponse As SomeWebservice.responseHistoricalData = New
SomeWebservice.responseHistoricalData

Ken
--------------
"BS" <lb*@nospam.com> wrote in message
news:O9**************@TK2MSFTNGP09.phx.gbl...
Hello
I posted a "short" version of the definition on the "webservice"
newsgroup.

http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl
Thank you for your help
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:Ox**************@tk2msftngp13.phx.gbl...
Hi,

You can an arraylist, collection, or array to a datagrid. Any
poperties in a class contained in class stored in one of the above will
be
shown in the datagrid. What format are you getting you data in?

Ken
------------------
"BS" <lb*@nospam.com> wrote in message
news:%2****************@TK2MSFTNGP10.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
>
>
>



Nov 20 '05 #5

P: n/a
Hi,
First off if you can only bind to properties in a class class
not public variables.

For example change
Public equipmentID As String

To
Private mstr_equipmentId As String

Public Property equipmentID() As String
Get
Return mstr_equipmentId
End Get
Set(ByVal Value As String)
mstr_equipmentId = Value
End Set
End Property

Second Try loading the data into an arraylist and bind to that.

oResponse = oES.historicalData(oRequest)
dim arBindto as new ArrayList
arBindto.Add(oResponse)
DataGrid1.DataSource = arBindto

Hope that helps.

Ken
-------------------
Nov 20 '05 #6

P: n/a
BS
Thank you Ken,

yes I already tried your suggestion of creating a "buffer" class for each
webservices functions called.
It works very well.

But that method did not seems efficient to me...add a new layer in between
the 2.Also, I should maybe mention that we do not have control to the web
service definitions...we did not write it. I have to use it as is.

But if that is the only solution...

Thank you very much for your help !
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:O0**************@TK2MSFTNGP09.phx.gbl...
Hi,
First off if you can only bind to properties in a class class
not public variables.

For example change
Public equipmentID As String

To
Private mstr_equipmentId As String

Public Property equipmentID() As String
Get
Return mstr_equipmentId
End Get
Set(ByVal Value As String)
mstr_equipmentId = Value
End Set
End Property

Second Try loading the data into an arraylist and bind to that.

oResponse = oES.historicalData(oRequest)
dim arBindto as new ArrayList
arBindto.Add(oResponse)
DataGrid1.DataSource = arBindto

Hope that helps.

Ken
-------------------

Nov 20 '05 #7

P: n/a
HI BS,

In my opinion is the solution Ken advises you is not inefficient however
very sufficient.

Cor
Nov 20 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.