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

use ItemTemplate in RadCombobox with dynamic binding

0 Answers 100 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
ck
Top achievements
Rank 1
ck asked on 29 Apr 2013, 09:56 AM
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

No answers yet. Maybe you can help?

Tags
ComboBox
Asked by
ck
Top achievements
Rank 1
Share this question
or