This is a migrated thread and some comments may be shown as answers.

DataTextField don't find the property

5 Answers 91 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Tajes
Top achievements
Rank 1
Tajes asked on 09 Feb 2011, 05:19 PM
Hello,

    I'm trying to bind an array of Provincia class objects to the RadComboBox. 

this.ProvinciaRadComboBox.DataSource = DiccionarioDatos.provincias; // Provincia[]
this.ProvinciaRadComboBox.DataTextField= "nombre";
this.ProvinciaRadComboBox.DataBind(); //<---the error is raised here

But when I run the follow error is raised:

Object of type assembly1.Provincia does not have a nombre property

And of course the Provincia class is public, and it has the public string property nombre. The class is defined in a different assembly, but with the reference added to it and also the using.

What I'm doing wrong?

Thanks in advance.

5 Answers, 1 is accepted

Sort by
0
Tajes
Top achievements
Rank 1
answered on 16 Feb 2011, 10:55 AM
Can anyone help me?
0
Boris
Top achievements
Rank 1
answered on 13 Nov 2012, 05:32 PM
I'm having the exact same problem.  Did you ever solve it?
0
Boyan Dimitrov
Telerik team
answered on 16 Nov 2012, 11:11 AM
Hello,

Please find attached a sample project that demonstrates binding an array of custom class objects to a RadComboBox. Please find the binding implementation in PageLoad event handler in code behind.  I also have included in the attachment the class implementation located in App_Code folder.

Regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Andrea
Top achievements
Rank 2
Iron
answered on 13 Mar 2013, 05:21 PM
Same problem for me.

Boyan your example ignore this: "The class is defined in a different assembly, but with the reference added to it and also the using."

Can you provide a working example whit this in mind?

In my case I bind combobox to a collection and the datetextvalue is a Class.PropertyAsObject.Description.... es. Provincia.City.PostalCode


0
Boyan Dimitrov
Telerik team
answered on 18 Mar 2013, 02:07 PM
Hello,

Please find attached project that contains the logic for your Province class in completely separate project as class library. The website has reference to that library and  the namespace is included by "using Europe".

Hope that this will be helpful.

Kind regards,
Boyan Dimitrov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ComboBox
Asked by
Tajes
Top achievements
Rank 1
Answers by
Tajes
Top achievements
Rank 1
Boris
Top achievements
Rank 1
Boyan Dimitrov
Telerik team
Andrea
Top achievements
Rank 2
Iron
Share this question
or