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

work out the position of the Token being removed

2 Answers 33 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 07 Oct 2013, 08:07 AM
I would like to know if its possible to work out which item, by its initial Position, is being removed.
My preference is to do this in the Code Behind, but the only Event that is vaguely right is the autoCompleteRecipients_EntryRemoved event, but i believe this event fires too late for what i need.

in Javascript, the event seems to be OnClientEntryRemoving.

basically, when the Token is clicked to be removed - lets say its the 5th Token out of 10 - i want to store the fact that it is the 5th Token.
I will then use this number else-where in my code.

EDIT: it is possible for my AutoCompleteBox to have two different Tokens (entities) with the same text although they are not the same entity from the database.
e.g: my AutoCompleteBox would have a Token called 'David' which refers to the 'Manager' Entity, and another Token called 'David' which refers to the 'Director' Entity, so i cant find the position simply by the Text showing on the Token.

thanks for any help you can give.

2 Answers, 1 is accepted

Sort by
0
Accepted
Nencho
Telerik team
answered on 10 Oct 2013, 08:44 AM
Hello David,

As you well guessed the suitable event for your scenario would be the OnClientEntryRemoving. You could loop through the Entries collection of the AutoCompleteBox and get the position of the Entry which is about to be removed.

As for your other questions - yes, it is possible. For example, you could store the Entity type in the id value of the entries. I had prepared a sample page for you, demonstrating both implementations. Find it attached and let me know if you have any questions. In addition, here is a video, demonstrating the behavior at my end.

Regards,
Nencho
Telerik
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 the blog feed now.
0
David
Top achievements
Rank 1
answered on 10 Oct 2013, 04:22 PM
That's a nice Video, thanks!
storing data in the Value & ID of the AutoBox was not something i was aware of.

cheers.


Tags
AutoCompleteBox
Asked by
David
Top achievements
Rank 1
Answers by
Nencho
Telerik team
David
Top achievements
Rank 1
Share this question
or