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

User Control in RadComboBox

3 Answers 43 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jean-Marc
Top achievements
Rank 1
Jean-Marc asked on 08 Sep 2011, 09:53 AM
Can I place a User Control inside a RadComboBox?
Something like this:
 
<telerik:RadComboBox ID="RadComboBoxCategoryLevels"
Width="400px"
AllowCustomText="false"
runat="server" >
<ItemTemplate >
<qsf:Catrunat="server" ID="MYCat" ></qsf:Cat>
</ItemTemplate>
<Items>
<telerik:RadComboBoxItem Text="" />
</Items>
</telerik:RadComboBox>

 

I tried, but it does not work, Thanks


3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 08 Sep 2011, 10:28 AM
Hello Jean,

Here is the code I tried that worked as expected.
aspx:
<telerik:RadComboBox ID="RadComboBox1" Filter="Contains" AllowCustomText="true" AppendDataBoundItems="true" runat="server" >
  <ItemTemplate>
     <uc1:uclistBox ID="uclistBox1" runat="server" />
     <%# DataBinder.Eval(Container, "Text") %>
  </ItemTemplate>
  <Items>
    <telerik:RadComboBoxItem Value="10/10/2010" Text="10/10/2010" />
    <telerik:RadComboBoxItem Value="10/3/2010" Text="10/3/2010" />
    <telerik:RadComboBoxItem Value="10/10/2010" Text="10/10/2010" />
    <telerik:RadComboBoxItem Text="Date1" IsSeparator="true" />
  </Items>
</telerik:RadComboBox>

Before the template can use the combobox item properties to bind the elements in the template, the application needs to explicitly bind the items by calling the DataBind method of the RadComboBoxItem objects:
C#:
protected void Page_Load(object sender, EventArgs e)
   {
       for (int i = 0; i < RadComboBox1.Items.Count; i++)
       {
           RadComboBox1.Items[i].DataBind();
       }
   }

Thanks,
Princy.
0
Jean-Marc
Top achievements
Rank 1
answered on 09 Sep 2011, 12:47 PM
Thanks, now everything works.
another question.
in my user control I have a RadTreeView, with properties and events to which I can not see just because the tree is located within the ComboBox.
there is a way to fix this?
thanks
0
Dimitar Terziev
Telerik team
answered on 13 Sep 2011, 01:35 PM
Hi Jean-Marc,

I've prepared a sample page based on the scenario that you have explained.

I hope this would help you out.

Best wishes,
Dimitar Terziev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Jean-Marc
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Jean-Marc
Top achievements
Rank 1
Dimitar Terziev
Telerik team
Share this question
or