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

How to change the Selectedvalue

7 Answers 1156 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Stefan
Top achievements
Rank 2
Stefan asked on 26 Apr 2009, 09:50 PM
Hello,

i am using the version 2009.1.9.414. and have great problems with the RadMultiColumnComboBox.
I have a ComboBox bound to a DataTable and now i want to select a Row in the ComboBox. In all other
ComboBoxes i know i would just set the SelectedValue of the ComboBox. My expectation is that the
correct row is selected and the Text of the ComboBox show the value of the DisplayMember of the Selected Row.

When i set the SelectedValue in the Telerik RadMultiColumnComboBox i get the follwoing result.
The Cell which will be found by the current Selected Row and the valuemember will be changed by the passed SelectValue.

This seems to be a bug and not a feature or a user error. Is there any workaround or is it possible to get a patch.
It is urgent because i am using telerik in a huge Project and am at the beginning time enough to change to Componentart or
Infragistics. I want to continue with Telerik so please help me.

Best regards
Stefan 

7 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 29 Apr 2009, 03:12 PM
Hi Stefan,

Thank you for contacting us. I have taken the paragraph below from Telerik documentation.

The EditorControl property of the MultiColumnComboBoxElement gives you a reference to the RadGridView control. Using that reference you can obtain the RadGridView object and work as with normal RadGridView control. Refer to RadGridView documentation for additional information on RadGridView.


So you need to take a reference to the internal grid and then select a row(s).

Here is the code to make a cell current:

 private void radButton1_Click_1(object sender, EventArgs e) 
        { 
            ((RadGridView)this.radMultiColumnComboBox1.EditorControl).CurrentRow = ((RadGridView)this.radMultiColumnComboBox1.EditorControl).Rows[2]; 
            ((RadGridView)this.radMultiColumnComboBox1.EditorControl).CurrentColumn = ((RadGridView)this.radMultiColumnComboBox1.EditorControl).Columns[0]; 
        } 

Here is the code for selecting two rows:

 ((RadGridView)this.radMultiColumnComboBox1.EditorControl).MultiSelect = true
            ((RadGridView)this.radMultiColumnComboBox1.EditorControl).Rows[1].IsSelected = true
            ((RadGridView)this.radMultiColumnComboBox1.EditorControl).Rows[2].IsSelected = true

Please read RadGridView documentation about the difference between current and selected rows.

Sincerely yours,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Stefan
Top achievements
Rank 2
answered on 29 Apr 2009, 06:39 PM

Hi Nick,

you didn't get my problem. I don't want to now how to select the row.

I have a value lets say Product 12 and now i want to select in a combobox 
this value. I don't know the row. I just want to set the property selected value
and then the combobox should automatically select the correct row. This functions
with all other comboboxes accept Teleriks. When i have a look with reflector on the
sourcecode, then it is clear why such a "buggy" behavior happen. Sorry but it is bullshit
to change the previously selected rows valuemember cell when I set the selectedvalue.

If Telerik does such a strange behavior just tell me how to solve my problem. There is a
function FindExactElement which is exactly the correct function to find the correct row,
but it is protected and belong to the MultiComboBoxElement. To much work for a verry
common function in all other Comboboxes.

 

I am very anoid how such a big bug could pass the quality guidelines of Telerik.

 

best regards

Stefan

0
Nick
Telerik team
answered on 30 Apr 2009, 02:27 PM
Hello Stefan,

Thank you for writing us back.

I have tested your scenario and found that there is an issue - the text value inside the text editor of the multicombobox is not updated, but the value (the selected row) is actually properly updated when you set the SelectedValue property. Here is the code that used to test your scenario and the simple work around of setting the Text accordingly:

private void Form1_Load(object sender, EventArgs e) 
{             
            List<Person> people = new List<Person>(); 
            Person john = new Person(); 
            john.Age= 10; 
            john.Name = "John"
            people.Add(john); 
 
            Person mary= new Person(); 
            mary.Age = 30; 
            mary.Name = "Mary"
            people.Add(mary); 
 
            this.radMultiColumnComboBox1.DataSource = people; 
 
private void radButton1_Click(object sender, EventArgs e) 
            this.radMultiColumnComboBox1.SelectedValue = "Mary"
            this.radMultiColumnComboBox1.Text = this.radMultiColumnComboBox1.SelectedValue.ToString(); 

I hope that this helps, however do not hesitate to write me back if you need further assistance.

Greetings,
Nick
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Gilberth
Top achievements
Rank 1
answered on 19 Aug 2009, 08:47 PM

hello again, taking advantage of already opened this topic, see about it, I have the same problem with the control MultiComboBox not update the text property of the control according to property SelectValue for me is a mistake because by I have this error as a programmer to do tricks to show information already stored, for example in the proof that I make the column assigned to the property ValueMember different than that assigned to the property DisplayMember for this reason I can not use the code example provided as a solution on this issue, what I do is find the text that should update the control text property and assign it to the show, this is not complicated but takes away the software because of performance that places it slower having to perform a search in the database again, the proof that I do besides this, fill the items from a table in the database, by default appears selected one of the items, but I do not see the text, I try to modify the value contained SelectValue property, but will not let me, it's as if you were just reading, but it does not seem as if because they did not send me any errors when changing the value in code, but it does not, I would like to help somehow, but I was a bit tricky given the code because the database is in MySQL, as I said before I hope can help me, thanks for everything.


Edit: Besides that I do not accept that the value of the property SelecValue, I have another error, this occurs when there is a change in the table which takes data MultiComboBox control, gives me the error that says that an item was deleted This is true, could help as saying the best way to fill data control, but that control error when I send the table data changes, so if the item is removed is the one currently selected. thanks again.

0
Jack
Telerik team
answered on 31 Aug 2009, 02:20 PM
Hi Gilberth,

I am not sure that I understand the issue correctly. Please, send us your application without the database and we will try to figure out the issue. You can do so in a new support ticket.

I am looking forward to your reply.
 

Regards,
Jack
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Gh Reza
Top achievements
Rank 1
answered on 26 Apr 2020, 02:46 AM

Hello ,

I'm using RadMultiColumnComboBox with data.

When fill binding source , radMultiColumnComboBox  select first item in binding source. I don't need this item and i want clear this item and display null value. How i can do it?

0
Nadya | Tech Support Engineer
Telerik team
answered on 29 Apr 2020, 09:44 AM

Hello Gh Reza,

In order to display a null value in the editable area in RadMultiColumnComboBox, you can set the SelectedItem property. This is good to happen in the Load event of the form:

private void RadForm1_Load(object sender, EventArgs e)
        {
            this.radMultiColumnComboBox1.SelectedItem = null;
        }

I hope this helps. Let me know if you have other questions.

Regards,
Nadya
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
MultiColumn ComboBox
Asked by
Stefan
Top achievements
Rank 2
Answers by
Nick
Telerik team
Stefan
Top achievements
Rank 2
Gilberth
Top achievements
Rank 1
Jack
Telerik team
Gh Reza
Top achievements
Rank 1
Nadya | Tech Support Engineer
Telerik team
Share this question
or