RadComboBox Clear

2 posts, 0 answers
  1. Allan
    Allan avatar
    121 posts
    Member since:
    Jun 2008

    Posted 07 Sep 2012 Link to this post

    I have a combo box that is set to AllowCustomText = "True", however, I just cant seem to get it to clear. Here is my code:

    <telerik:RadComboBox ID="rcb_Users" Runat="server" AutoPostBack="True"
        DataSourceID="sds_UserList" DataTextField="UserName"  AllowCustomText = "True"
        DataValueField="UserName" EmptyMessage="Select User" Height="150px"
        Skin="WebBlue" EnableAutomaticLoadOnDemand="True" EnableVirtualScrolling="True"
        ItemsPerRequest="100" ShowMoreResultsBox="True" OnClientKeyPressing="HandleKeyPressUN">
    </telerik:RadComboBox>


    Private Sub ClearRCB_LUUserName()
     
        rcb_Users.ClearSelection()
        rcb_Users.Text = String.Empty
     
    End Sub


    Any help much appreciated.

  2. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 10 Sep 2012 Link to this post

    Hi Allan,

    I have performed some tests based on the provided snippet of code, but could not replicate the experienced issue.
    The code below works at our side:

    ASPX
    <div>
          <telerik:RadComboBox ID="rcb_Users" runat="server" AutoPostBack="True" DataSourceID="sds_UserList"
              DataTextField="VehicleName" AllowCustomText="True" DataValueField="ID" EmptyMessage="Select Vehicle"
              Height="150px" Skin="WebBlue" EnableAutomaticLoadOnDemand="True" EnableVirtualScrolling="True"
              ItemsPerRequest="100" ShowMoreResultsBox="True" _OnClientKeyPressing="HandleKeyPressUN">
          </telerik:RadComboBox>
          <asp:SqlDataSource ID="sds_UserList" runat="server" ConnectionString="<%$ ConnectionStrings:TelerikConnectionString %>"
              SelectCommand="SELECT [ID], [VehicleName] FROM [Vehicles]"></asp:SqlDataSource>
          <telerik:RadButton runat="server" ID="button" OnClick="ClearRCB_LUUserName" Text="Click Me">
          </telerik:RadButton>
      </div>

    Code Behind:
    Partial Class _Default
        Inherits System.Web.UI.Page

        Protected Sub ClearRCB_LUUserName()
     
            rcb_Users.ClearSelection()
            rcb_Users.Text = String.Empty
     
        End Sub
    End Class

    Does it work at your side? If yes - could you please modify it so we can see the problem locally?

    Kind regards,
    Nencho
    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top