Ondemand Radcombobox with RadTreeView in itemtemplate

2 posts, 0 answers
  1. andy
    andy avatar
    13 posts
    Member since:
    Apr 2009

    Posted 12 Sep 2012 Link to this post

    I would like to have a Radcomobox with load-on-demand turned on, and as the user is typing a search term in the input box of the combobox, instead of showing the results as a plain list, I would like the results to appear in a treeview. I am having a lot of difficulty in doing this.

    I have gone through this forum post but it does not apply to my situation because I do not need to subscribe to nodeexpand event or nodeclick event. I need to subscribe to the combobox's itemsrequested event.

    If this is too difficult, any suggestion for a similar solution will be appreciated, where as a user is typing a search term in a textbox, the results are being displayed in a treeview, but taking care to not cause a postback on every single key click (by building a small delay like the combobox does).

    The error I am getting is: "Script control &#39'rtcICD9' is not a registered script control. Script controls must be registered using RegisterScriptControl() before calling RegisterScriptDescriptors(). Parameter name: scriptControl"

    Here is my code:
    <telerik:RadComboBox ID="ddlICD9Code" runat="server" Width="400px" MarkFirstMatch="true"
                                        AppendDataBoundItems="true" EnableLoadOnDemand="true" EnableItemCaching="true"
                                        MinFilterLength="3" ItemRequestTimeout="600"
                                        OnItemsRequested="ddlICD9Code_ItemsRequested" >
                                        <ItemTemplate>
                                            <telerik:RadTreeView runat="server" ID="rtvICD9" DataFieldID="Id" DataFieldParentID="ParentId" DataValueField="Id" DataTextField="LongName">
                                                <DataBindings>
                                                    <telerik:RadTreeNodeBinding Depth="0" />
                                                </DataBindings>
                                            </telerik:RadTreeView>
                                        </ItemTemplate>
                                        <Items>
                                            <telerik:RadComboBoxItem />
                                        </Items>
                                    </telerik:RadComboBox>
     
     
    protected void ddlICD9Code_ItemsRequested(object sender, RadComboBoxItemsRequestedEventArgs e)
        {
            string filterString = e.Text;
     
            if (filterString.Length >= 3)
            {
                var qry = execute database query here;
     
                RadTreeView rtvICD9 = ddlICD9Code.Items[0].FindControl("rtvICD9") as RadTreeView;
                rtvICD9.DataSource = qry;
                rtvICD9.DataBind();
            }      
        }
  2. Ivana
    Admin
    Ivana avatar
    657 posts

    Posted 12 Sep 2012 Link to this post

    Hello Andy,

    The desired functionality is not part of the advertised functionality of the control and is not offered out-of-the box. Since the content of the ItemTemplate of RadComboBox, in this case,  is not a regular HTML element or asp server control, the only way to achieve this functionality is to define load-on-demand RadTreeView inside the RadComboBox's ItemTemplate as it is explained in the pointed by you forum thread.

    The implementation of this functionality, as you have described it,  will require more time. Our recommendation in such cases is to contact our professional services: http://www.telerik.com/services/enterprise-solutions.aspx.

    I hope this is helpful!

    All the best,
    Ivana
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top