Hi,
Im using treeview in combobox.
URL with AJAXPanel: http://www.ximnet.com.my/aspnet35/telerik/treeview/
URL without AJAXPanel: http://www.ximnet.com.my/aspnet35/telerik/treeview/noajax/Default.aspx
Basically when user select language, the treeview will load the correct sections for selected language.
In the ajax version, when we select English, and select Sub Section B, we will get Section ASection BSub Section BSection C in the combobox, compared to the correct value in the non-ajax version.
My ASPX code:
Is there something I did wrong ?
Im using treeview in combobox.
URL with AJAXPanel: http://www.ximnet.com.my/aspnet35/telerik/treeview/
URL without AJAXPanel: http://www.ximnet.com.my/aspnet35/telerik/treeview/noajax/Default.aspx
Basically when user select language, the treeview will load the correct sections for selected language.
In the ajax version, when we select English, and select Sub Section B, we will get Section ASection BSub Section BSection C in the combobox, compared to the correct value in the non-ajax version.
My ASPX code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="telerik_treeview_Default" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<script type="text/javascript"> |
function comboLoad(sender, eventArgs) { |
sender.set_text(sender.get_items().getItem(0).get_value()); |
} |
function nodeClicking(sender, args) { |
var comboBox = $find("<%= cbSection.ClientID %>"); |
var node = args.get_node() |
comboBox.set_text(node.get_text()); |
comboBox.trackChanges(); |
comboBox.get_items().getItem(0).set_value(node.get_text()); |
comboBox.commitChanges(); |
comboBox.hideDropDown(); |
} |
function StopPropagation(e) { |
if (!e) { |
e = window.event; |
} |
e.cancelBubble = true; |
} |
function OnClientDropDownOpenedHandler(sender, eventArgs) { |
var tree = sender.get_items().getItem(0).findControl("TVSection"); |
var selectedNode = tree.get_selectedNode(); |
if (selectedNode) { |
selectedNode.scrollIntoView(); |
} |
} |
</script> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title></title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager1" runat="server"> |
</asp:ScriptManager> |
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Height="200px" Width="300px"> |
<div> |
<telerik:RadComboBox ID="cbLanguage" runat="server" ShowToggleImage="True" Skin="Default" |
Width="300px" AutoPostBack="True" CausesValidation="False"> |
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
</telerik:RadComboBox> |
</div> |
<div> |
<telerik:RadComboBox ID="cbSection" Text="Please select section" AllowCustomText="true" |
runat="server" Height="140px" Width="300px" ShowToggleImage="True" Skin="Default" |
OnClientLoad="comboLoad" OnClientDropDownOpened="OnClientDropDownOpenedHandler"> |
<ItemTemplate> |
<div id="div1"> |
<telerik:RadTreeView runat="server" ID="TVSection" OnClientNodeClicking="nodeClicking" |
Skin="Web20" /> |
</div> |
</ItemTemplate> |
<Items> |
<telerik:RadComboBoxItem Text="" /> |
</Items> |
<CollapseAnimation Type="None" /> |
<ExpandAnimation Type="None" /> |
</telerik:RadComboBox> |
<script type="text/javascript"> |
var div1 = document.getElementById("div1"); |
div1.onclick = StopPropagation; |
</script> |
</div> |
</telerik:RadAjaxPanel> |
</form> |
</body> |
</html> |
Is there something I did wrong ?