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

Creating Item Template in code

1 Answer 64 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Stewart
Top achievements
Rank 1
Stewart asked on 02 Nov 2011, 05:33 PM
Hi

I have a combobox that displays a longer description of the TextField when open than it displays when collapsed. I achieve this using an Item Template as below:

<telerik:RadComboBox ID="cmbP9" Runat="server" DataTextField="Code" DataValueField="P9CodeID" 
                ToolTip="P9" Width="200" DropDownWidth="400px" HighlightTemplatedItems="true">
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation>
   <ItemTemplate>
       <span>
       <asp:Literal runat="server" ID="litCode" Text='<%# Eval( "Code" )%>'></asp:Literal>
                     - 
      <asp:Literal runat="server" ID="litTitle" Text='<%# Eval( "Title" )%>'></asp:Literal>                    
       </span>
       <br />
   </ItemTemplate>
</telerik:RadComboBox>

I want to now be able to create a combobox like this entirely from code. How can I create an Item Template as above from code or is there another way of achieving the same thing?

Cheers

Stewart

1 Answer, 1 is accepted

Sort by
0
Kalina
Telerik team
answered on 02 Nov 2011, 06:08 PM
Hi Stewart,

Please take a look at the "Dynamic Multi-Column Template" CodeLibrary article - the approach that you can use to create templates dynamically is described in details there.
Additionally there is a  sample application that you can download.

Kind regards,
Kalina
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
Stewart
Top achievements
Rank 1
Answers by
Kalina
Telerik team
Share this question
or