AutoCompleteSeparator prevents update of Text in a databound RadComboBox

6 posts, 1 answers
  1. Kit West
    Kit West avatar
    7 posts
    Member since:
    Apr 2010

    Posted 07 Jun 2010 Link to this post

    It appears that the AutoCompleteSeparator property prevents the Text property from being updated in a databound RadComboBox when the SelectedIndex is changed during an AJAX postback. (So I click the Reset button, and the SelectedIndex gets set programmatically to 0, as intended, but users still see the previously selected text in the control.)

     

    <telerik:RadComboBox ID="MyComboBox" runat="server" Width="250" CausesValidation="false" AutoPostBack="false" MarkFirstMatch="true" AllowCustomText="false" AutoCompleteSeparator=";" ExpandAnimation-Duration="250" AccessKey="O" /> 
  2. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 10 Jun 2010 Link to this post

    Hi Kit West,

    The issue that you describe is very interesting, I tried to reproduce it on our side but unfortunately without success.
    What is the exact scenario that you are trying to implement?
    Could you please paste here some sample code that illustrates the issue using the "Format Code Block" tool?
    Thank you in advance.

    Regards,
    Kalina
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Kit West
    Kit West avatar
    7 posts
    Member since:
    Apr 2010

    Posted 10 Jun 2010 Link to this post

    Here is the markup (simplified) to reproduce the problem:
    <%@ Page Language="vb" EnableEventValidation="false" ValidateRequest="false" AutoEventWireup="false" 
      Inherits="MyNamespace.MyPage" CodeFile="MyPage.aspx.vb" Title="Demo" ViewStateEncryptionMode="Never" %> 
     
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> 
    <html> 
    <head id="Head1" runat="server">  
      <title>demo</title> 
    </head> 
    <body> 
      <form id="Form1" method="post" runat="server">  
      <ajax:ScriptManager ID="asm" runat="server" EnablePartialRendering="true" /> 
      <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true">  
        <AjaxSettings> 
          <telerik:AjaxSetting AjaxControlID="btnReset">  
            <UpdatedControls> 
              <telerik:AjaxUpdatedControl ControlID="ErrorsDiv" /> 
              <telerik:AjaxUpdatedControl ControlID="LookupDiv" /> 
            </UpdatedControls> 
          </telerik:AjaxSetting> 
        </AjaxSettings> 
      </telerik:RadAjaxManager> 
      <div id="LookupDiv" runat="server">  
        <telerik:RadComboBox ID="RadComboBox1" runat="server" CausesValidation="false" AutoPostBack="false" 
          AutoCompleteSeparator=";" /> 
        <asp:Button ID="btnReset" runat="server" Text="Reset" CausesValidation="false" /> 
      </div> 
      <div id="ErrorsDiv" runat="server">  
      </div> 
      </form> 
    </body> 
    </html> 

    And here is the code-behind:
    Option Strict On  
     
    Imports System  
    Imports System.Diagnostics  
    Imports Telerik.Web.UI  
     
    Namespace MyNamespace
     
      Partial Class MyPage : Inherits Page  
     
        Protected Sub MyPage_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load  
          ErrorsDiv.InnerText = "" 
          If Not Page.IsPostBack Then  
            RadComboBox1.Items.Insert(0, New RadComboBoxItem("0", "0"))  
            RadComboBox1.Items.Insert(1, New RadComboBoxItem("1", "1"))  
          End If  
        End Sub  
     
        Protected Sub btnReset_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnReset.Click  
          RadComboBox1.SelectedIndex = 0 
          ErrorsDiv.InnerText = "SelectedValue: " & RadComboBox1.SelectedValue _  
                    & ", SelectedIndex: " & RadComboBox1.SelectedIndex.ToString _  
                    & ", Text: " & RadComboBox1.Text  
        End Sub  
      End Class  
    End Namespace 

    Select a value from the drop-down, then click Reset. Although the Reset button changes the SelectedIndex, the Text of the RadComboBox is not changed. When I remove the AutoCompleteSeparator tag, it works as I would expect.
    (It may be related to the AjaxSettings.)
  4. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 16 Jun 2010 Link to this post

    Hello Kit West,

    Thank you for the sample code provided.
    You are right - the Text property is not changed after setting the SelectedIndex of the RadComboBox.

    Let me suggest you handle OnClientClick event of the button and clear the RadComboBox selection like this:

    <body>
        <form id="form1" runat="server">
        <div>
            <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="btnReset">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="ErrorsDiv" />
                            <telerik:AjaxUpdatedControl ControlID="LookupDiv" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <div id="LookupDiv" runat="server">
                <telerik:RadComboBox ID="RadComboBox1" runat="server"
                    CausesValidation="false" AutoPostBack="false" AutoCompleteSeparator=";"/>
                <asp:Button ID="btnReset" runat="server" Text="Reset"
                    CausesValidation="false" OnClick="btnReset_Click"
                    OnClientClick="OnClientClickHandler()" />
     
                <script type="text/javascript">
                    function OnClientClickHandler() {
                        var combo = $find("<%=RadComboBox1.ClientID %>");
                        combo.clearSelection();
                    }
                </script>
     
            </div>
            <div id="ErrorsDiv" runat="server">
            </div>
        </form>
    </body>

    I hope this helps.

    Best wishes,
    Kalina
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Kit West
    Kit West avatar
    7 posts
    Member since:
    Apr 2010

    Posted 18 Jun 2010 Link to this post

    Kalina,
    Thank you for your response. Actually, I don't need a work-around, since I can just omit the AutoCompleteSeparator property altogether. (Also, I'm not sure the combo.clearSelection() call would display the first item, as my server logic on the click event does.)

    What I would prefer is an acknowledgement of a "bug" from Telerik. This issue cost significant time to isolate, and I am posting in the hope that others will be able to troubleshoot this more efficiently.

    Best regards,
    Kit
  6. Answer
    Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 25 Jun 2010 Link to this post

    Hi Kit West,

    Thank you for taking the time to isolate this issue and providing a sample code to illustrate it.
    Please excuse us for any inconvenience this may have caused.

    We have already started investigating this issue and will continue our efforts to find a solution.

    Kind regards,
    Kalina
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top