ComboBox with EnableLoadOnDemand filtering *inner* Treeview

2 posts, 0 answers
  1. Rubens
    Rubens avatar
    28 posts
    Member since:
    Mar 2008

    Posted 06 Apr 2011 Link to this post

    Hi ALL,

    I've a combo with treeview for department selection. I want to use combo load on demand capability to filter that treeview, so I'll display all departments which contains entered text. I managed to sign to OnItemsRequest event to search my data source and repopulate that treeview.

    But, as that treeview required OnClientNodeClicking event to display department full name ("parent > parent > parent > this"), after postback this message shows up:

    Script control 'hierarquia' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors(). Parameter name: scriptControl

    I tried to add RegisterWithScriptManager="FALSE" on treeview and register that client event manually with no success. How should I proceed?

    So far I have this code snippets (some code removed):

    <telerik:RadComboBox runat="server" ID="selecao" Width="450" AutoPostBack="true"
        LoadingMessage="Loading..." EmptyMessage="Expanda a hierarquia e selecione..." 
        OnClientDropDownOpened="OnClientDropDownOpenedHandler" EnableLoadOnDemand="true"
        MinFilterLength="3" OnInit="selecao_Init" OnItemsRequested="selecao_ItemsRequested" 
            <telerik:RadComboBoxItem Text="" Value="0"/>
            <telerik:RadTreeView runat="server" ID="hierarquia" Width="300" 
                OnNodeExpand="hierarquia_NodeExpand" OnNodeClick="hierarquia_NodeClick"
                OnClientNodeClicking="nodeClicking" Skin="Default" CausesValidation="false" />

            protected void selecao_Init(object sender, EventArgs e)
                if (this.Hierarquia.Nodes.Count == 0)
                    RadTreeNodeCollection parent = this.Hierarquia.Nodes;
                    // load data
                #region ClientScriptBlock
                ScriptManager.RegisterClientScriptBlock(thistypeof(FiltroGenerico), "FiltroGenerico"@"
                    function nodeClicking(sender, args) {
                        var comboBox = $find(sender._clientStateFieldID.substring(0, sender._clientStateFieldID.length - 26));
                        var node = args.get_node()
                        var fullname = '';  // display full treename as requested
                        var pnode = node;
                        while(pnode != null && pnode.get_text != null)
                            fullname = ' > ' + pnode.get_text() + fullname;
                            pnode = pnode.get_parent();
                        fullname = fullname.substr(3)
                    function StopPropagation(e) {
                        if (!e)  e = window.event;
                        e.cancelBubble = true;
                    function OnClientItemsRequested(sender, eventArgs) {
                        var tree = sender.get_items().getItem(0).findControl('hierarquia');
                    function OnClientDropDownOpenedHandler(sender, eventArgs) {
                        var tree = sender.get_items().getItem(0).findControl('hierarquia');
                        var selectedNode = tree.get_selectedNode();
                        if (selectedNode) {

  2. Dimitar Terziev
    Dimitar Terziev avatar
    1268 posts

    Posted 12 Apr 2011 Link to this post

    Hello Rubens,

    You are receiving the following error since you couldn't load controls using load on demand mechanism. This is due to the fact that load on demand is causing callback not post-back to the server and thus the page life cycle is not executed. In general load on demand is used to load data not controls.

    Unfortunately you won't be able to implement this scenario using RadTreeView inside RadComboBox with Load on Demand. You should either give up on the load on demand or think of another template for the RadComboBox.

    All the best,
    Dimitar Terziev
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top