Clearing the text area

6 posts, 0 answers
  1. Bill
    Bill avatar
    3 posts
    Member since:
    Oct 2012

    Posted 17 Oct 2012 Link to this post

    When using the RadAutoCompleteBox, is there a way to clear the text of a previous selection in the text input area?  I have used the clear() method in both the RadAutoCompleteBox object and the AutoCompleteBoxEntryCollection object, which does indeed remove all the entries from the collection.  But there seems to be no way to get to the displayed selection in the text area and clear it also.  Thank you for any insight into this issue.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 18 Oct 2012 Link to this post

    Hi Bill,

    Try the following code to achieve your scenario.

    C#:
    protected void RadButton1_Click(object sender, EventArgs e)
    {
      RadAutoCompleteBox1.Entries.Clear();
    }

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 18 Oct 2012 Link to this post

    Hi Bill,

    Can you paste here the RadAutoCompleteBox markup that you use?

    Regards,
    Kalina
    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.
  5. Bill
    Bill avatar
    3 posts
    Member since:
    Oct 2012

    Posted 18 Oct 2012 Link to this post

    The suggestion works for me.  Thank you. 
    However I am confronted with another problem now.  Is there a way to block any typing/input in the text area after a selection is made?
    Is there some king of OnKeyPress event for this text box area?
  6. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 19 Oct 2012 Link to this post

    Hi Bill,

    You can disable the input element in OnClientEntryAdded event of RadAutoCompleteBox as follows.

    JS:
    <script type="text/javascript">
     function OnClientEntryAdded(sender, args)
     {
       sender.get_inputElement().disabled = true;
     }
    </script>

    Thanks,
    Princy.
  7. Bill
    Bill avatar
    3 posts
    Member since:
    Oct 2012

    Posted 19 Oct 2012 Link to this post

    Thanks for your help.  Everything is working now with my RadAutoCompleteBox implementation.. On to the next task.
    Bill
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017