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

RadCombo with TreeView ItemTemplate

1 Answer 93 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Himadri Banerjee
Top achievements
Rank 1
Himadri Banerjee asked on 03 Dec 2008, 10:22 AM
Dear Telerik Team
                            I am trying to use a RadTree Control as an ItemTemplate inside a RadCombo Control. I also want the treeView to get populated from the database using LoadOnDemand. For some reason I can't seem to get hold of the TreeView Control.
Strange behavior happens with different syntax.
----------------------------------------------------Problem 1------------------------------------------
If I define my ComboBox the Following Way which is Putting  
                        <Items>
                            <telerik:RadComboBoxItem Text="" Value="" />
                         </Items>

The Item_Requested Event is not firing.
<telerik:RadComboBox ID="ddlResource" runat="server" EnableLoadOnDemand="true" 
OnItemsRequested="RadComboBox1_ItemsRequested" Skin="WebBlue" Width="240px"
DropDownWidth="450" ItemRequestTimeout="500"
OnSelectedIndexChanged="ddlResource_SelectedIndexChanged">
<ItemTemplate>
   <div onclick="StopPropagation(event)">
      <telerik:RadTreeView ID="RadTreeView1" Width="100%" runat="server"                                                                                                   
              ShowLineImages="False"  Skin="WebBlue"
              Font-Names="Verdana" OnClientNodeClicked="ClientNodeClicked" Font-Size="Small">                                                                                                   
             </telerik:RadTreeView>
   </div>
 </ItemTemplate>
 <Items>
        <telerik:RadComboBoxItem Text="" Value="" />
 </Items>
 </telerik:RadComboBox>
Code Behind this way
protected void RadComboBox1_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
{

 RadTreeView treeView = ddlResource.Items[0].FindControl("RadTreeView1") as RadTreeView;

 if (treeView != null)
 {
    LoadTreeView(treeView);

  }

}


 

----------------------------------------------------Problem 2------------------------------------------
When I take the following lines away from the RadComboBox the ItemRequested Event is firing.
<Items>
        <telerik:RadComboBoxItem Text="" Value="" />
 </Items>
But when I change my CodeBehind to ddlResource.FindControl("RadTreeView1")  
treeView is returning null

 

 

protected void RadComboBox1_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
{

 RadTreeView treeView = ddlResource.FindControl("RadTreeView1") as RadTreeView;

 if (treeView != null)
 {
    LoadTreeView(treeView);

  }

}

 

I have tried a lot of things using <div> tag without <div>. But those did not make any difference. 

 

 

Please Help
Thanks
Himadri

 

1 Answer, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 05 Dec 2008, 01:45 PM
Hello Himadri,

I am afraid that this functionality is not supported by RadComboBox. I suggest you use the Load-On-Demand feature of RadTreeView instead. 

Regards,
Yana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
ComboBox
Asked by
Himadri Banerjee
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or