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

Ondemand Radcombobox with RadTreeView in itemtemplate

1 Answer 50 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
andy
Top achievements
Rank 1
andy asked on 12 Sep 2012, 06:28 AM
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();
        }      
    }

1 Answer, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 12 Sep 2012, 08:37 AM
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.
Tags
ComboBox
Asked by
andy
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Share this question
or