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

Binding RadComboBox with ObjectDataSource trough DataValueField="Property.Property"

1 Answer 344 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Carlos Fernando
Top achievements
Rank 1
Carlos Fernando asked on 22 Jun 2014, 09:31 PM
Hi, I'm trying to bind a RadComboBox with an ObjectDataSource (odsFuenteEmisionAlcance) that returns a List of Objects like these:

List<FuenteEmisionAlcance>
 
public class FuenteEmisionAlcance
{
    private FuenteEmision m_FuenteEmision;
    private Alcance m_Alcance;
  
    public FuenteEmision FuenteEmision
    {
        get { return m_FuenteEmision; }
        set { m_FuenteEmision = value; }
    }
 
    public Alcance Alcance
    {
        get { return m_Alcance; }
        set { m_Alcance = value; }
    }
}

This is my ComboBox

<telerik:RadComboBox ID="rcbFuenteEmision" runat="server" AutoPostBack="True" DataSourceID="odsFuenteEmisionAlcance" DataTextField="FuenteEmision.Nombre" DataValueField="FuenteEmision.Id" ZIndex="100000" CausesValidation="False" OnSelectedIndexChanged="rcbFuenteEmision_SelectedIndexChanged" EmptyMessage="--Seleccione--" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" OnDataBinding="rcbFuenteEmision_DataBinding"></telerik:RadComboBox>

I'm trying to use the DataTextField and DataValueField values from the Property FuenteEmision, but somehow is not getting it, this is what I get:

[NotSupportedException: Object of type HUC.FuenteEmisionAlcance does not have a FuenteEmision.Nombre property.]


Like I show before the object FuenteEmisionAlcance does a have a FuenteEmision property, the combo is able to find it, i've tried using only DataTextField="FuenteEmision" and DataValueField="FuenteEmision" just to try and it does find it, but when it comes to find a property from the property it crashes, is this impossible? or there is another way I can acomplish this.


1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 23 Jun 2014, 07:18 AM
Hi Carlos Fernando,

Please have a look into this help documentation and online demo which shows binding of RadComboBox using ObjectDataSource. Please provide your full code if it doesn't help.

Thanks,
Shinu.
Tags
ComboBox
Asked by
Carlos Fernando
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or