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

RadComboBox - Client object model problem

2 Answers 106 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Brad
Top achievements
Rank 1
Brad asked on 06 Oct 2011, 01:20 AM

In the Telerik documentation for the RadComboBox client object model it gives this information for clearing the selection.

ClearSelection


<script>
   function ClearSelection()
   {
       var combo = <%=RadComboBox1.ClientID %>;
       combo.ClearSelection();
   }
</script>

You can see this code on this page

http://www.telerik.com/help/aspnet/combobox/combo_client_model.html

This code does not work. The first line 'var combo....' fails to execute. Even having this code on the page gives me this error that appears as a little green line under the < character.

Expected Expression

I was able to fix this code with some jQuery (note my combo box has a different name.)

var combo = $find("<%#radCustomSearchDropdown.ClientID %>");

This line works as you can see in the attached image.  combo now points to the RadComboBox.

But my problem did not stop there.

Once this line is executed Firebug report the following error.

combo.ClearSelection is not a function

For reference my Combo Box looks like this

<telerik:RadComboBox
    ID="radCustomSearchDropdown" runat="server" Height="200px" Width="200px" DropDownWidth="350px"
    EmptyMessage="Custom Search"
    HighlightTemplatedItems="true"
    EnableLoadOnDemand="true"
    Filter="StartsWith"
    OnSelectedIndexChanged="radCustomSearchDropdown_SelectedIndexChanged"
    AutoPostBack="true">
    
    <ItemTemplate>
        <table style="width: 275px" cellspacing="0" cellpadding="0">
            <tr>
                <td style="width: 260px;">
                    <strong><%# DataBinder.Eval(Container, "Attributes['Title']")%></strong>
                </td>
            </tr>
            <tr>   
                <td style="width: 260px;">
                    <i><%# DataBinder.Eval(Container, "Attributes['Description']")%></i>
                </td>
            </tr>
        </table>
    </ItemTemplate>
</telerik:RadComboBox>

Note that I do have the RadComboBoxScripts.js file included in my page.

Where is combo.ClearSelection?

I just want a client side method to reset the combo box. Any help would be much appreciated.







2 Answers, 1 is accepted

Sort by
0
Ivana
Telerik team
answered on 07 Oct 2011, 10:05 AM
Hi Brad,

I noticed that you refer to the online documentation for the classic asp.net controls (the ones that are not using ajax). Could you please share the information where did you find links to the old documentation?

However, a full documentation about the ajaxified controls could be found at the following link at our website: RadControls for ASP.NET AJAX Documentation.

To see how you could find the RadComboBox object client-side, you could refer to the following help article:
RadComboBox: Client-Side Object.

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
0
Brad
Top achievements
Rank 1
answered on 09 Oct 2011, 11:55 PM
Ivana

I am sure the link to the documentation I found was the result of a google search. Beyond that I am not exactly sure how I found it.

Thanks for the links to the proper docs. I'll check them out now.

Brad
Tags
General Discussions
Asked by
Brad
Top achievements
Rank 1
Answers by
Ivana
Telerik team
Brad
Top achievements
Rank 1
Share this question
or