P
pauled
Hello all,
Framework 1.1 VS 2003 Binding listbox.
I have an array of objects that I am trying to use as the datasource
for a listbox. The array is returned from a webservice and seems to be
populated ok, see this text from my Autos pane in VS, once the
datasource property has been set.
- DataSource {System.Array} System.Object
- [0] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
System.Object {RiskReport.TLDManager.Country} System.Object
CountryID 11 int
Name "Australia" string
TLDs <undefined value> RiskReport.TLDManager.TLD[]
+ [1] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [2] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [3] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [4] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [5] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [6] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [7] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [8] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
As you can see (I've opened the first array item) each Country object
contains 3 properties (CountryID,Name and TLDs) and I am trying to set
the text field to name and the value to CountryID:-
this.lbCountries.DataSource = api.GetCountries();
this.lbCountries.DataTextField = "Name";
this.lbCountries.DataValueField = "CountryID";
this.lbCountries.DataBind();
However on binding I get the error 'RiskReport.TLDManager.Country' does
not contain a property with the name Name. It is spelt correctly and
there are no leading or trailing spaces, this also applies to the
CountryID if I comment out the line to set the DataTextField.
Any help appreciated.
Paul
Framework 1.1 VS 2003 Binding listbox.
I have an array of objects that I am trying to use as the datasource
for a listbox. The array is returned from a webservice and seems to be
populated ok, see this text from my Autos pane in VS, once the
datasource property has been set.
- DataSource {System.Array} System.Object
- [0] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
System.Object {RiskReport.TLDManager.Country} System.Object
CountryID 11 int
Name "Australia" string
TLDs <undefined value> RiskReport.TLDManager.TLD[]
+ [1] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [2] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [3] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [4] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [5] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [6] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [7] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
+ [8] {RiskReport.TLDManager.Country} RiskReport.TLDManager.Country
As you can see (I've opened the first array item) each Country object
contains 3 properties (CountryID,Name and TLDs) and I am trying to set
the text field to name and the value to CountryID:-
this.lbCountries.DataSource = api.GetCountries();
this.lbCountries.DataTextField = "Name";
this.lbCountries.DataValueField = "CountryID";
this.lbCountries.DataBind();
However on binding I get the error 'RiskReport.TLDManager.Country' does
not contain a property with the name Name. It is spelt correctly and
there are no leading or trailing spaces, this also applies to the
CountryID if I comment out the line to set the DataTextField.
Any help appreciated.
Paul