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

set disabled style

4 Answers 127 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
charles
Top achievements
Rank 1
charles asked on 27 Feb 2009, 05:52 AM
I use a RadComboBox
when a RadComboBox is disabled, its text is gray.
Customer want the the text sytle of the disabled RadComboBox is normal(not gray just as the color that RadComboBox is enable)

How can i implement it whit RadComboBox?

I have a solution that setting  RadComboBox enable, but when you click the right image to display its items, nothing will happen.
so that the RadComboBox looks like is disabled but its color is normal.
can I add some javascript to achieve this?

4 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 27 Feb 2009, 10:02 AM
Hello Charles,

You can use the following code to avoid the dropdown from displaying items:
aspx:
  <telerik:RadComboBox DataSourceID="SqlDataSource2" AutoPostBack="true" DataTextField="FirstName"
    
DataValueField="FirstName" ID="RadComboBox2" runat="server" OnClientDropDownOpening="DropDownOpening" > 
  </telerik:RadComboBox> 

js:
<script type="text/javascript"
 function DropDownOpening(sender, eventArgs) 
 { 
   eventArgs.set_cancel(true);  
 } 
</script> 

Thanks
Princy.
0
Paul
Telerik team
answered on 27 Feb 2009, 12:23 PM
Hi Charles,

Please mind that IE and Firefox treat differently a disabled item. IE automatically grays the text of the disabled item, but FF does not.

Kind regards,
Paul
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
charles
Top achievements
Rank 1
answered on 27 Feb 2009, 02:57 PM
Hi Princy
Thank your help very much
0
charles
Top achievements
Rank 1
answered on 27 Feb 2009, 04:52 PM
<script type="text/javascript"
 function DropDownOpening(sender, eventArgs) 
 { 
   eventArgs.set_cancel(true);  
 } 
</script> 


i meet javascript errors when i run this script .
this reason is eventArgs is null;

however when change javascript like this:
<script type="text/javascript"
 function DropDownOpening(sender, eventArgs) 
 { 
   return false;
 } 
</script> 

It works

Tags
ComboBox
Asked by
charles
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Paul
Telerik team
charles
Top achievements
Rank 1
Share this question
or