OnEntryAdded / OnEntryRemoved not firing!

5 posts, 0 answers
  1. mqsash
    mqsash avatar
    31 posts
    Member since:
    May 2012

    Posted 13 Feb 2013 Link to this post

    Hi

    I have the following markup defining an autocomplete box and the event handler function.
    The autocompletebox works fine - that it displays the suggestions as I type and I can select / remove entries.
    Unfortunately when I change the autocomplete selection (add or remove selected entries) the OnEntryAdded / OnEntryRemoved are not being fired. Any idea what I might be missing?

    I might be missing something very basic here... but I just don't see it.
    Any help will be most appreciated.

    Thanks

    <telerik:RadAutoCompleteBox
       ID="OperatorAutoCompleteBox"
      runat="server"
      DropDownHeight="150"
      EmptyMessage="(Select Operator)"
      DataSourceID="sqlOperatorsLookupList"
      DataTextField="Full_Name"
      DataValueField="Operator_ID"
      Filter="Contains"
      InputType="Text"
      OnEntryAdded="OperatorAutoCompleteBox_SelectedOperatorChanged"
      OnEntryRemoved="OperatorAutoCompleteBox_SelectedOperatorChanged"
      AutoPostBack="true">
     
     </telerik:RadAutoCompleteBox>

      Protected Sub OperatorAutoCompleteBox_SelectedOperatorChanged(sender As Object, e As AutoCompleteEntryEventArgs)
        do something here...
      End Sub
  2. mqsash
    mqsash avatar
    31 posts
    Member since:
    May 2012

    Posted 13 Feb 2013 Link to this post

    hmm... if only I read the documentation more thoroughly... The EntryAdded is available only if InputType is set to "token" :(
    http://www.telerik.com/help/aspnet-ajax/autocompletebox-onentryadded.html

    Unfortunately, I can't use Tokens because I want to restrict the user to select only one value, which only works with InputType="Text".

    For autocompletes with InputType="Text" use the TextChangedEvent!  
    http://www.telerik.com/help/aspnet-ajax/autocompletebox-ontextchanged.html

    But in this case when I try to read the value of the selected entry I get a blank!
    The Entries(0).Text has the displayed text of the selected entry but the Entries(0).value is blank!
    If all I do is remove the "OnTextChanged="{myhandler}"  from the markup, the codebehind is starts to return the correct value in the the Entries(0).Value.
    Seems like having the OnTextChanged handler defined causes the control to no longer know the corresponding "value" of the selected "text".

    Is that a bug? I am using v 2012.3.1308.

    Thanks
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mark Kucera
    Mark Kucera avatar
    84 posts
    Member since:
    Sep 2009

    Posted 18 Feb 2013 Link to this post

    Yeah, i was just getting ready to post something similar to this.  This control is absolutely frustrating.  Probably because it has so much potential but it seems to have such a lousy implementation.  It would be better for Telerik to split this into two separate controls and not have the InputMode attribute..  The input mode drives the display of the control, but apparently it also drives functionality because certain events only fire when you are using a specific input mode.  This is in the documentation, but it's absolutely nuts..  It's also crazy that the only way to restrict a user to selecting one item is in text mode.  but when you are in text mode you lose the ability to select an entity that has both a name and a value.  This is ridiculous.  I want single select functionality of the text mode combined with the entity name/value aspect of the token mode editing. 

    -Mark
  5. Nencho
    Admin
    Nencho avatar
    1458 posts

    Posted 18 Feb 2013 Link to this post

    Hello S S,

    I am not quite sure that I understood your scenario and how exactly you encountered the issue. Could you specify with which  Input you have faced the issue? In addition, you could easily restrict the user to select only one entry, when the InputType is set to Token, with handling the OnClientDropDownOpening and verifying the count of the entered entries. Please consider the following implementation:

    function OnClientDropDownOpening(sender, eventArgs) {
     
                if (sender.get_entries().get_count() > 0) {
                    eventArgs.set_cancel(true);
                }
     
            }



    Regards,
    Nencho
    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.
  6. Mark Kucera
    Mark Kucera avatar
    84 posts
    Member since:
    Sep 2009

    Posted 18 Feb 2013 Link to this post

    This seems to work, so i'm going with it for now.  I think the overall issue is that its up to us, the developers to implement single-select for token input when it's already implemented for text input..
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017