Update: Ignore this post or close it. The problem was not the RadComboBox itself.
Best regards
Martin
Hi,
I've a RadComboBox inside a UserControl with the DropDropStyle=DropDownList. I added three elements and after that I selected the third one:
radComboBoxItems.Add(new RadComboBoxItem("1", 1));
radComboBox.Items.Add(new RadComboBoxItem("2", 2));
radComboBox.Items.Add(new RadComboBoxItem("3", 3));
radComboBoxSelectedValue = 3;
I also tried:
radComboBoxSelectedIndex = 2;
In both ways the the SelectedIndex is correct and when the ListBox appears the correct item is selected. But the ComboBox itself doesn't display the selected item. The funny thing is, that the same code works fine on a Windows Form. So, what's the problem there.
Regards
Martin
7 Answers, 1 is accepted
Justin are you using the RadComboBox or the RadDropDownList?
Are you using a data source for the control or items?
Please answer these questions and i will help you find a solution.
Best Regards,
Emanuel Varga
Telerik WinForms MVP
Sorry, I could not replicate this issue.
Please try the following and let me know if this is working for you:
using
System;
using
System.Windows.Forms;
using
Telerik.WinControls.UI;
public
partial
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
var userControl =
new
SomeUserControl();
this
.Controls.Add(userControl);
userControl.Dock = DockStyle.Fill;
}
}
public
class
SomeUserControl : UserControl
{
private
RadComboBox radComboBox;
public
SomeUserControl()
{
this
.Controls.Add(radComboBox =
new
RadComboBox());
radComboBox.Items.Add(
new
RadComboBoxItem(
"1"
, 1));
radComboBox.Items.Add(
new
RadComboBoxItem(
"2"
, 2));
radComboBox.Items.Add(
new
RadComboBoxItem(
"3"
, 3));
}
protected
override
void
OnLoad(EventArgs e)
{
base
.OnLoad(e);
radComboBox.SelectedValue = 3;
}
}
Or what are you doing differently.
Hope this helps, if you have any other questions or comments, please let me know,
Best Regards,
Emanuel Varga
Telerik WinForms MVP
I was not able to replicate this issue as well. Please try Emanuel's suggestion and let us know if it worked for you. If it did not, then please provide us with more details about your case - a code snippet or a sample project. The version of the controls you are using might also be important.
I am looking forward to hearing from you.
Best wishes,
Could you explain what the problem actually was?
I am having the exact same problem.
regards,
Matthew
Thank you for writing.
As you can notice, the issue in this thread has not yet been identified. Therefore, if you experience any issues, you can open a new support ticket or a forum thread and describe the issue in detail. This will let us investigate it and provide you with proper support.
Additionally, if you are contacting us via a support ticket, you can attach a sample project which demonstrates the issue. This will help us in isolating the issue and provide you with a quicker response.
I am looking forward to hearing from you.
Greetings,
Ivan Todorov
the Telerik team