DataTextField don't find the property

6 posts, 0 answers
  1. Tajes
    Tajes avatar
    81 posts
    Member since:
    Sep 2009

    Posted 09 Feb 2011 Link to this post

    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.
  2. Tajes
    Tajes avatar
    81 posts
    Member since:
    Sep 2009

    Posted 16 Feb 2011 Link to this post

    Can anyone help me?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Boris
    Boris avatar
    275 posts
    Member since:
    Oct 2012

    Posted 13 Nov 2012 Link to this post

    I'm having the exact same problem.  Did you ever solve it?
  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 16 Nov 2012 Link to this post

    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.
  6. Andrea
    Andrea avatar
    64 posts
    Member since:
    Jan 2005

    Posted 13 Mar 2013 Link to this post

    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


  7. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 18 Mar 2013 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017