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

ReadOnly for ComboBox?

9 Answers 903 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.
Joshua Ruppert
Top achievements
Rank 1
Joshua Ruppert asked on 15 Jan 2008, 12:38 AM
Is there anything I can do to have a ComboBox behave has a read only element, like you can with a TextBox?

I want to have a field that displays data, but is not always editable, and isn't the hard to read gray-on-gray of the disabled state. I generally suppress the dropdown and then use a light gray back ground with black text, but I don't see anyway to suppress the dropdown.

Is there a way to achieve what I'm looking for?

Josh

9 Answers, 1 is accepted

Sort by
0
Georgi
Telerik team
answered on 16 Jan 2008, 02:17 PM

Hi Joshua Ruppert,

Thank you for writing.

As far as I understand, you would like a different appearance from the default RadComboBox when the control is disabled (the Enabled property is set to false). Since in this state an image is drawn onto the control itself, you cannot change it.

However, thanks to the element hierarchy of our controls and the theming mechanism, you can change this behavior. You should implement your custom theme with added states to the necessary elements with condition when RadElement.Enabled property is set to false. Then all you have to do is to apply the theme and set the UseDefaultDisabledPaint property to false as shown below:

    RadComboBox.ComboBoxElement.UseDefaultDisabledPaint = false;

If you need any further assistance, please write us again.

Sincerely yours,

Georgi
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Joshua Ruppert
Top achievements
Rank 1
answered on 17 Jan 2008, 03:47 PM
Thanks, I'll try that.

Josh
0
Michael
Top achievements
Rank 1
answered on 21 Jan 2008, 05:53 AM
Another solution is to set the property, DropDownStyle to DropDownList. This allows the control to maintain it's color and behave in a readonly manner.

You can change this property in the Properties window from the Design View of your Form.

I hope this helps.

Michael
0
Joshua Ruppert
Top achievements
Rank 1
answered on 21 Jan 2008, 03:00 PM
I've done this, but it's not quite what I'm looking for. A read-only drop down for me would suppress the display of the dropdown list, as well as preventing of typing into the field.
0
Kiril
Telerik team
answered on 22 Jan 2008, 09:00 AM
Hello Joshua Ruppert,

I just wanted to make sure that you have achieved the control behavior you were looking for using the solution we provided in our last post.

Please let us know if we can help you any further.

Regards,
Kiril
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Feizal Amlani
Top achievements
Rank 1
answered on 28 Sep 2010, 07:46 PM
Hello,

I am trying to implement the same behaviour.  Is it possible to manipulate the combobox to a readonly control.  For example, the view only mode would show 'Canada'.  When the user selects the update link on the page the text (Canada) will change to a combobox where the user can update the country.

I don't want to put two controls on the page but manipulate the combobox in displaying the full behaviour to just displaying the selected text in different modes.

Thanks,
Feizal
0
Peter
Telerik team
answered on 30 Sep 2010, 04:18 PM
Hi Feizal Amlani,

In this case the solution is to set the property, DropDownStyle to DropDownList. This will prevent you from typing in the control's TextBox part. In addition, you should subscribe and cancel the event DropDownOpening:

void radDropDownList1_PopupOpening(object sender, CancelEventArgs e)
{
   if( this.radDropDownList1.DropDownStyle==DropDownList)
   {
     e.Cancel = true;
   }
}

I hope this helps.

 

Best wishes,
Peter
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
Feizal Amlani
Top achievements
Rank 1
answered on 30 Sep 2010, 09:20 PM
Thanks for your reply.  However, I am using a RadComboBox and not a RadDropDownList and there is no DropDownStyle property for the combobox.

Is there a way to implement the behaviour using the combobox?

Thanks,
Feizal
0
Peter
Telerik team
answered on 05 Oct 2010, 09:18 PM
Hello Feizal,

Thanks for writing back.

I am not sure why you can't find the DropDownStyle property at RadComboBox. The following code snippet should work on your side:

RadComboBox radComboBox1 = new RadComboBox();
radComboBox1.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList;

Please refer to this article for additional information.

Generally, I would recommend updating to RadDropDownList. RadComboBox is an obsolete control and it will be removed in one of our next version. Please find additional information about RadDropdownList here.

I hope this will help.

Sincerely yours,
Peter
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 and ListBox (obsolete as of Q2 2010)
Asked by
Joshua Ruppert
Top achievements
Rank 1
Answers by
Georgi
Telerik team
Joshua Ruppert
Top achievements
Rank 1
Michael
Top achievements
Rank 1
Kiril
Telerik team
Feizal Amlani
Top achievements
Rank 1
Peter
Telerik team
Share this question
or