Disable selection from Radcombobox list of values

3.8k Views Asked by At

I want to list all the items in the radcombobox (Values are binded from dataset) but user should not be allowed to select any value from radcombobox.

User should able to see all the items but selecting an item should be disabled.

I would appreciate any help. Thanks in advance.

2

There are 2 best solutions below

2
On BEST ANSWER

You can do it in aspx part of the page. Right in this way.

<telerik:RadComboBox x:Name="radComboBox" Width="200">
        <telerik:RadComboBoxItem Content="Alapattah" IsEnabled="False"/>
        <telerik:RadComboBoxItem Content="Brickell Avenue" />
        <telerik:RadComboBoxItem Content="Downtown Miami" IsEnabled="False"/>
    </telerik:RadComboBox>

But if you are binding it programatically, you can do something like this:

foreach(RadComboBoxItem item in radComboBox.Items)
{
    item.Enabled = false;
}

Then in both cases user can view, but can't select disabled items.

More info is here: http://docs.telerik.com/devtools/wpf/controls/radcombobox/howto/enable-disable-radcombobox-items

0
On

Assign the data to the RadComboBox.DataSource. Then disable the combobox. "Name" and "Value" must be a part of your dataset returned from the stored proc.

In this example, I am using a EntityFramework lambda expression to get list of Users.

The table has 3 column - UserId, Name, Salary

combo.DataSource = dbCtx.tbl_users.Where(u => u.salary > 1000).OrderBy(u => u.user_id).ToList();
combo.DataTextField = "Name"
combo.DataValueField = "UserId";
combo.Enabled = false;