RadComboBox ClearSelection

2 posts, 0 answers
  1. Frank
    Frank avatar
    3 posts
    Member since:
    Feb 2011

    Posted 25 Apr 2013 Link to this post

    I know there are a number of threads with this issue, I just wanted to post my specific implementation and see if there is a solution to the corner I seem to be in.

    Here is my combobox declaration:
    <telerik:RadComboBox runat="server" ID="rcbAssetAssoc" ZIndex="100100" Enabled="false" AllowCustomText="false" MarkFirstMatch="true" Width="100%" Height="190px" EnableLoadOnDemand="true" HighlightTemplatedItems="true" OnItemDataBound="rcbAssetAssoc_ItemDataBound">
    <li class="multiColBoxItem">Serial #</li>
    <li class="multiColBoxItem">Asset #</li>
    <li class="multiColBoxItem">Machine Name</li>
    <li class="multiColBoxItem"><%# Eval("SerialNumber") %></li>
    <li class="multiColBoxItem"><%# Eval("AssetNumber") %></li>
    <li class="multiColBoxItem"><%# Eval("MachineName") %></li>
    <asp:Panel runat="server" CssClass="multiColBoxFooter">
    <asp:Label runat="server" ID="lblAssetAssocCount" SkinID="atBlueForm" />

    I have read the solution to clear the selection as:

    rcbAssetAssoc.Text = "";

    and that if the combobox is read-only the AllowCustomText="true" must be set to enable the clear to work.

    However, if I set the AllowCustomText="true" that creates a bug in my code because I don't want the user typing in their own values.

    Am I missing something?

    At the end of the day I want a templated dropdown that forces the user to select one of the options with auto-complete style functionality AND have the box clear ready for the next selection.
  2. Plamen
    Plamen avatar
    3057 posts

    Posted 30 Apr 2013 Link to this post

    Hello Brian,

    One possible solution that worked properly at my side was adding a default item and using the ClearSelection after that as in the code below:

    <DefaultItem Text="" Value="-1"/>
    protected void RadButton1_Click(object sender, EventArgs e)

    Hope this will be helpful.

    Kind regards,
    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