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

Clearing the text area

5 Answers 637 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 1
Bill asked on 17 Oct 2012, 08:54 PM
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.

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 18 Oct 2012, 05:40 AM
Hi Bill,

Try the following code to achieve your scenario.

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

Thanks,
Princy.
0
Kalina
Telerik team
answered on 18 Oct 2012, 11:01 AM
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.
0
Bill
Top achievements
Rank 1
answered on 18 Oct 2012, 04:44 PM
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?
0
Princy
Top achievements
Rank 2
answered on 19 Oct 2012, 05:30 AM
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.
0
Bill
Top achievements
Rank 1
answered on 19 Oct 2012, 01:08 PM
Thanks for your help.  Everything is working now with my RadAutoCompleteBox implementation.. On to the next task.
Bill
Tags
AutoCompleteBox
Asked by
Bill
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Kalina
Telerik team
Bill
Top achievements
Rank 1
Share this question
or