combobox with custom items

2 posts, 0 answers
  1. sf
    sf avatar
    103 posts
    Member since:
    Apr 2009

    Posted 10 Nov 2010 Link to this post

    is it possible to add 2 linkbutton controls inside a radcombobox? the demo only uses databound template items...
    thanks in advance
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 10 Nov 2010 Link to this post

    I am not quite sure about your requirement.
    If you want to add the link button for all the items, then you could make use of ItemTemplate and add from mark-up itself.

    <telerik:RadComboBox DataSourceID="SqlDataSource1" HighlightTemplatedItems="true"
                DataTextField="LastName" DataValueField="LastName" ID="RadComboBox1" runat="server"
                AllowCustomText="true" OnItemCreated="RadComboBox1_ItemCreated">
                    <asp:LinkButton ID="LinkButton1" runat="server" Text="lButton1"></asp:LinkButton>
                    <asp:LinkButton ID="LinkButton2" runat="server" Text="lButton2"></asp:LinkButton>

    In the case of you need LinkButtons as first two items, then you can do it in the RadComboBox1_ItemCreated event like below.

    protected void RadComboBox1_ItemCreated(object sender, Telerik.Web.UI.RadComboBoxItemEventArgs e)
          if (e.Item.Index < 2)
              LinkButton lnkButton = new LinkButton();
              lnkButton.Text = "New LinkButton";

    Feel free to share the comments.

Back to Top