Creating Item Template in code

2 posts, 0 answers
  1. Stewart
    Stewart avatar
    4 posts
    Member since:
    Nov 2011

    Posted 02 Nov 2011 Link to this post


    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>
           <asp:Literal runat="server" ID="litCode" Text='<%# Eval( "Code" )%>'></asp:Literal>
          <asp:Literal runat="server" ID="litTitle" Text='<%# Eval( "Title" )%>'></asp:Literal>                    
           <br />

    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?


  2. Kalina
    Kalina avatar
    918 posts

    Posted 02 Nov 2011 Link to this post

    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,
    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