I've embedded a RadTreeView in a RadComboBox much like the online example, except that I've added event handlers to the RadTreeView for the NodeClick event. I've also wrapped all of this in an AJAX Panel to avoid causing a full page post-back. But, it seems like the RadTreeView simply ignores this AJAX wrapper and causes a full page post-back anyway.
I've included a code sample:
I included the second RadComboBox just to show that the AJAX panel works for simpler controls.
I've included a code sample:
<%@ Page Language="C#" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<script runat="server"> |
protected void TreeView_SelectedIndexChanged( object sender, EventArgs e ) |
{ |
RadTreeView rtv = (RadTreeView) sender; |
RadComboBoxItem item = CB1.SelectedItem; |
item.Text = rtv.SelectedNode.Text; |
item.Value = rtv.SelectedValue; |
} |
protected void ComboBox_SelectedIndexChanged( object sender, EventArgs e ) |
{ |
RadComboBox rcb = sender as RadComboBox; |
LIT1.Text = rcb.SelectedItem.Text; |
} |
</script> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title></title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="Mgr1" runat="server"></asp:ScriptManager> |
<telerik:RadAjaxPanel ID="RAP1" runat="server" EnableAJAX="true"> |
<telerik:RadComboBox ID="CB1" runat="server" AutoPostBack="true"> |
<ItemTemplate> |
<telerik:RadTreeView ID="TV1" runat="server" OnNodeClick="TreeView_SelectedIndexChanged"> |
<Nodes> |
<telerik:RadTreeNode Text="Node 1" Value="1"></telerik:RadTreeNode> |
<telerik:RadTreeNode Text="Node 2 - Parent" Value="1"> |
<Nodes> |
<telerik:RadTreeNode Text="Node 2.1" Value="2.1"></telerik:RadTreeNode> |
<telerik:RadTreeNode Text="Node 2.2" Value="2.2"></telerik:RadTreeNode> |
</Nodes> |
</telerik:RadTreeNode> |
<telerik:RadTreeNode Text="Node 3" Value="3"></telerik:RadTreeNode> |
</Nodes> |
</telerik:RadTreeView> |
</ItemTemplate> |
<Items> |
<telerik:RadComboBoxItem Text="None" Value="" /> |
</Items> |
</telerik:RadComboBox> |
</telerik:RadAjaxPanel> |
<telerik:RadAjaxPanel ID="RAP2" runat="server" EnableAJAX="true"> |
<telerik:RadComboBox ID="CB2" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ComboBox_SelectedIndexChanged"> |
<Items> |
<telerik:RadComboBoxItem Text="Item 1" Value="1" /> |
<telerik:RadComboBoxItem Text="Item 2" Value="2" /> |
<telerik:RadComboBoxItem Text="Item 3" Value="3" /> |
</Items> |
</telerik:RadComboBox> |
<asp:Literal ID="LIT1" runat="server">Item Value</asp:Literal> |
</telerik:RadAjaxPanel> |
</form> |
</body> |
</html> |
I included the second RadComboBox just to show that the AJAX panel works for simpler controls.