use ItemTemplate in RadCombobox with dynamic binding

1 posts, 0 answers
  1. ck
    ck avatar
    28 posts
    Member since:
    Mar 2013

    Posted 29 Apr 2013 Link to this post

    Hi, I am using a RadCombobox to display a list of values from a DB. i want to display two columns separated by a '-' as the Text so i used 
    this:
    <telerik:RadComboBox runat="server" ID="tlkBiennium" EmptyMessage="select a biennium from the list" Filter="Contains" Width="200" AppendDataBoundItems="true" DataValueField="BienniumId">
                        <ItemTemplate>
                            <table>
                                <tr>
                                    <td><%# DataBinder.Eval(Container.DataItem,"StartYear") %></td>
                                    <td>-</td>
                                    <td><%# DataBinder.Eval(Container.DataItem,"EndYear") %></td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </telerik:RadComboBox>

    in the code behind:
    if(!IsPostBack){
        tlkBiennium.DataSource = container.Bienniums.ToList();
        tlkBiennium.DataBind();
    }

    the items are displayed properly however when  select one, I get the name of the class in the combobox. 
    can someone tell me what i am doing wrong?
    thanks
Back to Top