ClearSelection method undefined

2 posts, 0 answers
  1. Guillaume
    Guillaume avatar
    15 posts
    Member since:
    Oct 2010

    Posted 27 Jan 2014 Link to this post


    I am trying to reset the value set in a combobox of a ComboBox used in a UserControl.

    UserControl looks like that :

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UserControl.ascx.cs" Inherits="UserControls.UserControl" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
        <telerik:RadComboBox ID="comboBox" runat="server" 
        EnableVirtualScrolling="false" EnableTextSelection="true" MaxHeight="250px" 
        AllowCustomText="False" MarkFirstMatch="false" ShowMoreResultsBox="true" 
        Filter="Contains" EnableLoadOnDemand="True" Sort="Ascending" Width="280px" 
        OnItemsRequested="comboBox_ItemsRequested" AutoPostBack="True" 
        OnSelectedIndexChanged="comboBox_SelectedIndexChanged" CausesValidation="false" 
        ZIndex="1000" ontextchanged="comboBox_TextChanged"></telerik:RadComboBox>

    When I try to call the ClearSelection of the comboBox in default.aspx like that :

    <body onload="Load()" >
    <uc1:UserControl ID="cboComboBox" runat="server" Width="95%" MaxHeight="175px" />
    <script type="text/javascript">
        function Load() {
            var cboComboBox= document.getElementById('<%=cboComboBox.FindControl("comboBox").ClientID%>');

    I keep getting the error "Method undefined"

    Any idea why ?



  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 27 Jan 2014 in reply to Guillaume Link to this post


    Please try the following JavaScript which works fine at my end.

    <script type="text/javascript">
     function Load() {
       var cboComboBox =document.getElementById('<%=cboComboBox.FindControl("comboBox").ClientID%>');

  3. DevCraft R3 2016 release webinar banner
Back to Top