This is a migrated thread and some comments may be shown as answers.
RadDropDownList ReadOnly
9 Answers 315 Views
This is a migrated thread and some comments may be shown as answers.
IGOR
Top achievements
Rank 1
IGOR asked on 15 Nov 2010, 10:36 PM
Hi,
Is there ways to make RadDropDownList text as "ReadOnly" in Run Time mode?

9 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 16 Nov 2010, 12:36 AM
Hello IGOR,

Yes, just change the dropdownstyle to dropdownlist.
this.radDropDownList1.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList;

hope that helps
richard
0
IGOR
Top achievements
Rank 1
answered on 16 Nov 2010, 03:43 PM
Thanks a lot Richard.
It was so clear to understand. I was thinking about something tricky like "...ReadOnly=true" :-)
I'm new with TELERIK.

Thanks a lot again.

Igor

0
Richard Slade
Top achievements
Rank 2
answered on 16 Nov 2010, 03:46 PM
Glad to be of help Igor. May I ask that you mark the reply as answer though so others can find the solution too.
Best regards,
Richard
0
Aziz
Top achievements
Rank 1
answered on 08 Jul 2013, 04:13 PM
no no, setting the drop down style to drop down list still enables the user to change the drop down by picking another one from the list.
what i want to do is to block the user from changing the value, like .enabled = false but with enabled = false the text becomes grayed out and horribly unreadable.
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 09 Jul 2013, 08:57 AM
Hi, 

There are 2 easy ways to do this. 

1: If you still want the user to be able to open the DropDownList to show the possible values, but not allow changes, then you can use the "SelectedIndexChanging" event like this: 

Private Sub DropDownList_SelectedIndexChanging(sender As System.Object, e As Telerik.WinControls.UI.Data.PositionChangingCancelEventArgs) Handles DropDownList.SelectedIndexChanging
    e.Cancel = True
End Sub

2: If you don't want the user to open the list, you can cancel the PopUpOpening event

Private Sub DropDownListOpening(sender As Object, e As CancelEventArgs) Handles DropDownList.PopupOpening
    e.Cancel = True
End Sub

Hope this helps
Richard
0
Peter
Telerik team
answered on 11 Jul 2013, 01:39 PM
Hello Aziz,

The ReadOnly property is not common for all controls and only few controls are implementing it (RadTextBox, RadSpinEditor) - in case that you want to prevent RadDropDownList from interaction with user you should use Richard's solution.

There is a feature request for such property, feel free to add your vote for it here: http://www.telerik.com/support/pits.aspx#/details/Issue=10738.

I hope this helps.

Regards,
Peter
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Aziz
Top achievements
Rank 1
answered on 11 Jul 2013, 05:22 PM
Yes it helps, thank you.
nevertheless, i cannot help but noticing how ComponentOne have a ".readonly" property for their drop down list. and using it takes much less code than the solution you suggest ;)
0
Peter
Telerik team
answered on 16 Jul 2013, 02:03 PM
Hi Aziz,

Thank you for writing back.

As I mentioned the ReadOnly property is not common for all controls (for example Microsoft ComboxBox does not implement this property). You can use the Enable property (which is common for all controls) in order to disable user interaction with this control.

Should you have any other questions, do not hesitate to ask.

Regards,
Peter
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Richard Slade
Top achievements
Rank 2
answered on 16 Jul 2013, 02:38 PM
Aziz, 

In addition to Peter's comments, you could also have a look at my answer in this thread which shows how to make readonly editors for all sorts of RadControl. 

Hope this helps you further
Richard
Asked by
IGOR
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
IGOR
Top achievements
Rank 1
Aziz
Top achievements
Rank 1
Peter
Telerik team
Share this question
or