Text issue on radCombobox using MarkFirstMatch

9 posts, 0 answers
  1. Avinash Kumar
    Avinash Kumar avatar
    9 posts
    Member since:
    Apr 2010

    Posted 24 May 2010 Link to this post

    Hi team,

    I am using a rad combo box with MarkFirstMatch property.On a button click I am assigning the radComboText box with some values.
    Now when I try to add another value to the text box by entering a delimiter(; in my case) at the end of the text inside the textbox, the existing values are getting erased and only the first value in the combo box is getting dispalyed in the textbox. This is totally undesirable as all the values present in the text box would be gone and there is no way to get back those values.

    IMO this is hapening because the first value is getting highlighted when the combobox opens.
    Once I erase all the values and type in new values then click outside(for the dropdown to close) and then try adding another value
    using the delimiter it gives me no problem .

    Following is the piece of code I used for assigning values to radText box.

    for(int i = 0; i < Projects.Count; i++) 
    radComboBox[0].Text = radComboBox[0].Text + Projects[i].Value.ToString() +Constants.chrsemicolon; 


    Can you please find a solution for this one.Help needed.

    Thanks,
    Avinash
  2. Avinash Kumar
    Avinash Kumar avatar
    9 posts
    Member since:
    Apr 2010

    Posted 24 May 2010 Link to this post

    Hi waiting for some solution :(.


    Thanks,
    Avinash
  3. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 27 May 2010 Link to this post

    Hello Avinash Kumar,

    Thank you for reporting this issue to us - it looks like a bug and I will research it.
    I also updated your Telerik points.

    Could you please explain your implementation in more details and paste the full code here?
    Thank you in advance.

    All the best,
    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.
  4. Avinash Kumar
    Avinash Kumar avatar
    9 posts
    Member since:
    Apr 2010

    Posted 27 May 2010 Link to this post

    Hi Kalina,

    We are using radcomboboxes and populating them using entitydatasource.
    Here is the code for a radcombobox:
    <telerik:RadComboBox ID="ComboBox1" runat="server" EmptyMessage="" Width="300px"   
        Skin="Forest" DataSourceID="EntityDataSource1" DataTextField="Name" 
        DataValueField="ID" AllowCustomText="false" MarkFirstMatch="true" AutoCompleteSeparator=";" Text="All Values" 
        >   
    <Items> 
        <telerik:RadComboBoxItem Text="" /> 
    </Items> 
    </telerik:RadComboBox> 
    <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=DataWarehouseEntities" 
        DefaultContainerName="DataWarehouseEntities" EntitySetName="vwNames" EntityTypeFilter="vwNames" 
        Select="it.[Name], it.[ID]">  
    </asp:EntityDataSource> 

    On click of a button only specific values would be assigned to a radcombobox.
    Here is the code:

    for(int i = 0; i < Projects.Count; i++) 
    radComboBox[0].Text = radComboBox[0].Text + Projects[i].Value.ToString() +Constants.chrsemicolon; 

    As I see, when we try to add a new value all the values are getting erased and only the 'highlighted' value in the dropdown is getting displayed in text box.
    Is there any work around for this like removing the highlighting of the value as soon as drop down opens ..?

    Would be very thankful if you can find a solution for this. It is very urgent.

    Thanks,
    Avinash

  5. Avinash Kumar
    Avinash Kumar avatar
    9 posts
    Member since:
    Apr 2010

    Posted 29 May 2010 Link to this post

    Any luck??
  6. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 01 Jun 2010 Link to this post

    Hi Avinash Kumar,

    I tried to use your code to replicate the issue on our side but unfortunately without success.
    Could you please explain in more details what is the scenario that you are trying to implement, maybe I miss something?
    Please paste here the full code of your implementation using the "Format Code Block" tool - we need a running sample on our side in order to continue our research.

    Regarding your question about RadComboBox item highlighting - you can remove the highlighting of an item when dropdown opens by handling the OnClientDropDownOpening event:
    function onDropDownOpening(sender) {
      var highlightedItem = sender.get_highlightedItem();
                
      if (highlightedItem)
          highlightedItem.unHighlight();
      }

    Greetings,
    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.
  7. Avinash Kumar
    Avinash Kumar avatar
    9 posts
    Member since:
    Apr 2010

    Posted 02 Jun 2010 Link to this post

    Hi Kalina thanks for the piece of code. The problem seems to be solved when no value is highlighted on dropdown opening.

    Here is the code you asked for:
    <telerik:RadComboBox ID="ComboBox1" runat="server" EmptyMessage="" Width="300px"      
        Skin="Forest" DataSourceID="EntityDataSource1" DataTextField="Name"    
        DataValueField="ID" AllowCustomText="false" MarkFirstMatch="true" AutoCompleteSeparator=";" Text="All Values"    
        >      
    <Items>    
        <telerik:RadComboBoxItem Text="" />    
    </Items>    
    </telerik:RadComboBox>    
    <asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=DataWarehouseEntities"    
        DefaultContainerName="DataWarehouseEntities" EntitySetName="vwNames" EntityTypeFilter="vwNames"    
        Select="it.[Name], it.[ID]">     
    </asp:EntityDataSource>    
     

    I was able to reproduce the issue with the following code (Value1 is one of the values in the combobox) .Bind the data and then click on this button without editing the ComboBox text.Now when we type semicolon at the end, the value highlighted in the dropdown(i.e. first value in dropdown) would be displayed instead of "Value1".
    protected void Button_Click(object sender, EventArgs e)  
    {  
    ...  
        ComboBox1.Text = "Value1";  
    ...  

    Also can we remove the highlighting of the values in the dropdown when we start typing in the combobox text box?

    Thanks,
    Avinash

  8. Avinash Kumar
    Avinash Kumar avatar
    9 posts
    Member since:
    Apr 2010

    Posted 02 Jun 2010 Link to this post

    Oh I'm sorry the issue is still there...

    Thanks,
    Avinash
  9. Kalina
    Admin
    Kalina avatar
    918 posts

    Posted 08 Jun 2010 Link to this post

    Hi Avinash Kumar,

    Let me suggest  you handle OnClientBlur event and remove item highlighting like this:
    function OnClientBlurHandler(sender) {
        
        var highlightedItem = sender.get_highlightedItem();
     
        if (highlightedItem)
            highlightedItem.unHighlight();
    }
    <telerik:RadComboBox ID="ComboBox1" runat="server" EmptyMessage="All Values" Width="300px"
        Skin="Forest" DataSourceID="SqlDataSource1" DataTextField="ProductName"
        DataValueField="ProductID" AllowCustomText="false"
        OnClientBlur="OnClientBlurHandler" 
        OnClientDropDownOpening="onDropDownOpening"
        MarkFirstMatch="true" AutoCompleteSeparator=";" Text="All Values">

    I created a sample page using the code snippet that you provided.
    Since I do not have the entity datasource classes that you use - I populated the RadComboBox via ordinary SqlDataSource - which is similar to your logic.
    I performed tests with this sample page and it works properly on my side.
    Please take a look at this demonstration video.

    Greetings,
    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