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

Combobox value changes

5 Answers 220 Views
ComboBox and ListBox (obsolete as of Q2 2010)
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Francis
Top achievements
Rank 1
Francis asked on 07 May 2009, 04:06 PM
Hi,

here is my problem :
I have a radtabstrip with several tab items : the first item is a panel with a list of records, when you double click on a record, all the infos about the record are displayed in a new tab so a very easy application ...
Some informations about records are displayed in combobox plugged on binding source (a new binding source is created for each new tab so that the combobox are not linked).

The problem is when I open a second tab about a record, when I click on the tab of the first record, combo are initialized to the first value of the list and don't remember the initial value of the record :( The last tab item always have the right info in the combobox but all others tab items are reinitialized and I don't understand why :(

Thank you for your help, if you have any question I'm here to explain better my problem ...

Regards

5 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 08 May 2009, 07:31 AM
Hello Francis,

Thanks for your questions.

I will be very grateful if you can create a simple Windows Forms applications with a RadTabStrip control which can be used to reproduce the behavior you described. This will be of a great help to me when researching the issue and I will be able to provide a better solution. I am looking forward to receiving the details requested. Thanks for your time.

Regards,
Deyan
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
MikeB
Top achievements
Rank 1
answered on 13 Jul 2009, 04:07 PM
I'm experiencing a similar issue.  It seems that the cbo_valueChanged event gets triggered when the cbo dataSource is set.  The event selects the first item in the dataSource list.  While this might be a desired process most of the time, It causes a problem when you want to set the selected value to something other than the 1st value.  Should one of the other events be used instead of the valueChanged?

Thanks,
Mike
0
Mike
Telerik team
answered on 17 Jul 2009, 09:35 AM
Hello MikeB,

This behavior - the SelectedValue event is fired when you change the DataSource is by design. If you want to select another item after changing the DataSource you may store temporary the selected value and then restore it after the DataSource has been changed. The code may look like the following:

int value = -1; 
if (null != this.radComboBox1.SelectedValue) 
    value = (int)this.radComboBox1.SelectedValue; 
 
this.radComboBox1.DisplayMember = "Display"
this.radComboBox1.ValueMember = "Id"
this.radComboBox1.DataSource = list; 
 
if (value != -1) 
    this.radComboBox1.SelectedValue = value; 

Let us know if the problem persists.

Best wishes,
Mike
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
MikeB
Top achievements
Rank 1
answered on 17 Jul 2009, 01:46 PM
Hi Mike
Thanks for the reply and the code snippet.  I was able to accomplish the same results with this:

            cboMultAccount.SelectedValueChanged -= cboAcct_ValueChanged;
            cboMultAccount.DataSource = acctList;
            cboMultAccount.SelectedValueChanged += cboAcct_ValueChanged;

Is this common behavior (for the selected value to be set when the data source is set)?

Thanks,
Mike


0
Nick
Telerik team
answered on 21 Jul 2009, 12:12 PM
Hi MikeB,

Thank you for contacting us back. Yes this is common because the CurrencyManager position is reset to 0.

Kind regards,
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.
Tags
ComboBox and ListBox (obsolete as of Q2 2010)
Asked by
Francis
Top achievements
Rank 1
Answers by
Deyan
Telerik team
MikeB
Top achievements
Rank 1
Mike
Telerik team
Nick
Telerik team
Share this question
or