OnTextChange causes loss of Value property?

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

    Posted 14 Feb 2013 Link to this post

    Hi 

    I'm using v2012.3.1308.35 and am running into an issue where I am getting an empty Value for the selected entry in the autocomplete box.

    Here's my markup:
    Note that InputType="Text" and I have registered an OnTextChanged handler.

    <telerik:RadAutoCompleteBox
      ID="OperatorAutoCompleteBox"
      runat="server"
      DataSourceID="sqlOperatorsLookupList"
      DataTextField="Full_Name"
      DataValueField="Operator_ID"
      Filter="Contains"
      InputType="Text"
      OnTextChanged="OperatorAutoCompleteBox_SelectedOperatorChanged">
     
      <TextSettings SelectionMode="Single" />
     
    </telerik:RadAutoCompleteBox>

    Now in the codebehind if I do the following, then the selectedText gets the actual selected text but the selectedValue is an empty string.

    If OperatorAutCompleteBox.Entries.Count > 0 Then
      selectedText = OperatorAutoCompleteBox.Entries(0).Text
      selectedValue = OperatorAutoCompleteBox.Entries(0).Value
    End If

    Strangely the Entries(0).Value starts to function normally (i.e return the selected value) if I remove the OnTextChanged="....." line from the markup. So to me it seems like registering the OnTextChanged somehow causes the RadAutoCompleteBox to lose its Value property.

    Is this a known bug?
    Could this be something from the remains of when InputType="Text" did not support the Value property?

    (see: http://www.telerik.com/community/forums/aspnet-ajax/autocompletebox/entry-value-is-empty.aspx#2219318 )

    FYI - Switching to InputType=Token, or removing the OnTextChanged is not an option for me as I need to limit a single selection and also use the OnTextChanged to populate other controls on what the user has selected.

    Thanks 

  2. Simon
    Simon avatar
    1 posts
    Member since:
    Feb 2013

    Posted 15 Feb 2013 Link to this post

    I've noticed a similar behavior. Does my selected item contains one or more apostrophes ("), then I get a blank value after losing focus to the control. In debug mode I could see, that the OnTextChanged event is not fired.

    Thanks for your help
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. mqsash
    mqsash avatar
    31 posts
    Member since:
    May 2012

    Posted 15 Feb 2013 Link to this post

    No, I don't have apostrophes in the selected text nor values.The text is just regular names and the values are integer IDs.
    Also the same data works fine when I do no define the OnTextChangedHandler in the markup for the RadAutoCompleteBox, so I am inclined to think that this has something to do with how the Rad control registers this handler.

  5. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 19 Feb 2013 Link to this post

    Hello S S,

    The described problematic behavior is a bug. I have forwarded it to our developer team for further consideration. Thank you for reporting for that issue. In addition, your Telerik Points are updated.

    Kind 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. Tom
    Tom avatar
    10 posts
    Member since:
    May 2013

    Posted 24 Apr 2014 Link to this post

    Has this been resolved? I have the same issue but with the event being triggered from a radgrid.
  7. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 29 Apr 2014 Link to this post

    Hello Tom,

    I can confirm that the reported in this thread bug is already fixed. Could you elaborate a bit more on your scenario and what exactly is the faced issue?

    Regards,
    Nencho
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
  8. Tom
    Tom avatar
    10 posts
    Member since:
    May 2013

    Posted 29 Apr 2014 in reply to Nencho Link to this post

    Hi Nencho,

    I have an autocompletebox in a grid templatecolumn. The grid is setup with an Ajax callback using the AjaxManager.

    <telerik:RadAutoCompleteBox runat="server" ID="customersDDL" AutoPostBack="true" OnTextChanged="customersDDL_TextChanged" OnClientRequesting="requesting" InputType="Text" Width="300px" TextSettings-SelectionMode="Single">
                                        <WebServiceSettings Method="GetCustomerList" Path="AccountingSync.aspx" />
                                    </telerik:RadAutoCompleteBox>

    How do I get the Value (ID) of the entry? The only option I get in the callback AutoCompleteTextEventArgs is to retrieve the Text. I need to check the Value to see if it is being used somewhere else already and notify the user that the selected item is already being used somewhere...they can still continue to use so the message is just informational.

    Thanks,
    Tom
  9. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 01 May 2014 Link to this post

    Hello Tom,

    You could access the value, by using the Entries collection of the RadAutoCompleteBox. Please consider the following implementation for the TextChanged event:

    protected void customersDDL_TextChanged(object sender, AutoCompleteTextEventArgs e)
          {
              RadAutoCompleteBox autoComplete = sender as RadAutoCompleteBox;
              string value = autoComplete.Entries[0].Value;
          }

    Regards,
    Nencho
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017