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

Combobox

5 Answers 118 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Senthil ramna
Top achievements
Rank 1
Senthil ramna asked on 17 Aug 2010, 05:58 AM
how to disble typing in Combox i.e how to restrict user from typing in the combobox.
In asp combobox to disable user entry we change the dropdown style of the combobox to DropDownList.

the thing is i am loading items in combobox on page load and on selected index change i am redirecting it to another page based on.
so can i validated the combobox if user types text which is not present in the combobox.
this is how my code looks.

<telerik:RadComboBox ID="radProject" AllowCustomText="false" AccessibilityMode="false" AutoPostBack="true" runat="server" DropDownWidth="240px" onselectedindexchanged="radProject_SelectedIndexChanged"                          EnableLoadOnDemand="true" MarkFirstMatch="true"  Skin="Web20" Filter="None">

time being i have kept filter = none
please suggest something...................

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Aug 2010, 07:25 AM
Hello Senthil,

I am not sure why do you set the EnableLoadOnDemand and MarkFirstMatch property of RadComboBox as true. If you want to restrict the user from typing in RadComboBox, you could set EnableLoadOnDemad and MarkFirstMatch as false along with AllowCustomText="false".
 

Thanks,
Princy.
0
Senthil ramna
Top achievements
Rank 1
answered on 17 Aug 2010, 07:45 AM
Thanks a lot Princy that worked like a charm.
Also wanted to ask if i do set EnableLoadOnDemad, MarkFirstMatch and AllowCustomText to true, how to restrict user from entering text which is not in a display member of combobox items.
Like lets say i have India, USA and Russia as my combobox items then if i type in Spain in the combobox how to give a message to the user that this item is not present in the combobox list of items.
i would like to do this validation in the OnSlectedindexchanged event please let me know if this can be done.
thanks again.
0
Princy
Top achievements
Rank 2
answered on 18 Aug 2010, 02:49 PM
Hello,


I believe, you can iterate through the radcombobox items in client side and check with the items text. The following links will help you in achieving this on client side.
Client-Side Basics
RadComboBox object
RadComboBoxItem object


Thanks,
Princy.
0
Senthil ramna
Top achievements
Rank 1
answered on 26 Aug 2010, 08:10 AM
Thanks for the links princy helped me lot.
Also one other thing
I am using Radcombobox version 2009.1.311.35.
In this i wanted to increase the dropdown width as some of the text were of larger length, so i set the DropDownWidth size to 240px and the width of my ComboBox is 150px (standard i am using in all my pages).
The question is this how can i make sure that the DropDownWidth will increase and decrease itself based on the size of the Items in the list. I found this http://www.telerik.com/help/winforms/combo_propertiessizing.html which looks pretty cool, where i can set the maximum and minimum DroDownSIze for the ComboBox, but this is for winforms.
Can you tell me how i can achieve the same for ASP.NET AJAX ComboBox
Thanks again Princy
0
Princy
Top achievements
Rank 2
answered on 26 Aug 2010, 02:38 PM
Hello Senthil,


I hope the following code library will be of help.
Dynamic Dropdown width


Thanks,
Princy.
Tags
ComboBox
Asked by
Senthil ramna
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Senthil ramna
Top achievements
Rank 1
Share this question
or