This is a migrated thread and some comments may be shown as answers.

Text issue on radCombobox using MarkFirstMatch

8 Answers 245 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Avinash Kumar
Top achievements
Rank 1
Avinash Kumar asked on 24 May 2010, 08:13 AM
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

8 Answers, 1 is accepted

Sort by
0
Avinash Kumar
Top achievements
Rank 1
answered on 24 May 2010, 06:54 PM
Hi waiting for some solution :(.


Thanks,
Avinash
0
Kalina
Telerik team
answered on 27 May 2010, 09:52 AM
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.
0
Avinash Kumar
Top achievements
Rank 1
answered on 27 May 2010, 01:25 PM
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

0
Avinash Kumar
Top achievements
Rank 1
answered on 29 May 2010, 01:44 PM
Any luck??
0
Kalina
Telerik team
answered on 01 Jun 2010, 04:34 PM
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.
0
Avinash Kumar
Top achievements
Rank 1
answered on 02 Jun 2010, 11:05 AM
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

0
Avinash Kumar
Top achievements
Rank 1
answered on 02 Jun 2010, 07:19 PM
Oh I'm sorry the issue is still there...

Thanks,
Avinash
0
Kalina
Telerik team
answered on 08 Jun 2010, 10:02 AM
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.
Tags
ComboBox
Asked by
Avinash Kumar
Top achievements
Rank 1
Answers by
Avinash Kumar
Top achievements
Rank 1
Kalina
Telerik team
Share this question
or