work out the position of the Token being removed

3 posts, 1 answers
  1. David
    David avatar
    38 posts
    Member since:
    May 2013

    Posted 07 Oct 2013 Link to this post

    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. Answer
    Nencho avatar
    1446 posts

    Posted 10 Oct 2013 Link to this post

    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.

    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.
  3. DevCraft R3 2016 release webinar banner
  4. David
    David avatar
    38 posts
    Member since:
    May 2013

    Posted 10 Oct 2013 Link to this post

    That's a nice Video, thanks!
    storing data in the Value & ID of the AutoBox was not something i was aware of.


Back to Top