John Fetherolf
Top achievements
Rank 1
John Fetherolf
asked on 31 Jan 2008, 08:59 PM
I am trying to setup a RadComboBox where the first item has a different background color than the rest of the items in the list. For some reason the BackColor property on the item is not being passed to the generated HTML page when I do a "view source" in the browser. Here is the control markup:
I must be missing something here?
Thanks,
Kevin
| <telerik:RadComboBox ID="selShipTo" runat="server" AppendDataBoundItems="true" |
| DataTextField="OneLineDisplay" DataValueField="AddressID" style="width: 75%;"> |
| <Items> |
| <telerik:RadComboBoxItem runat="server" BackColor="Blue" Text="<<< Use Billing Address >>>" Value="0" /> |
| </Items> |
| </telerik:RadComboBox> |
I must be missing something here?
Thanks,
Kevin
6 Answers, 1 is accepted
0
Hello John Fetherolf,
The reason for this is because the Default skin is applied to RadComboBox when the Skin property is not set. Therefore it overwrites the BackColor property.
I suggest to set the CssClass property of that particular item instead of BackColor.
Consider the following example:
I hope this helps.
Best wishes,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
The reason for this is because the Default skin is applied to RadComboBox when the Skin property is not set. Therefore it overwrites the BackColor property.
I suggest to set the CssClass property of that particular item instead of BackColor.
Consider the following example:
| <telerik:RadComboBoxItem runat="server" Text="<<< Use Billing Address >>>" |
| Value="0" CssClass="blueColor" /> |
| <style type="text/css"> |
| .blueColor{ |
| background-color: blue !important; |
| } |
| </style> |
I hope this helps.
Best wishes,
Veskoni
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Gary
Top achievements
Rank 1
answered on 18 Mar 2009, 05:47 PM
Should this work with version 2.2 of the RadCombo box? I can't seem to get it to work. Thanks
Gary
Gary
0
Hi Gary,
I suppose that you are using RadComboBox for ASP.NET and this solution is for RadComboBox for ASP.NET AJAX. Is this the case?
Kind regards,
Yana
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.
I suppose that you are using RadComboBox for ASP.NET and this solution is for RadComboBox for ASP.NET AJAX. Is this the case?
Kind regards,
Yana
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
Jonathan
Top achievements
Rank 1
answered on 22 Jul 2009, 10:34 PM
Hello,
I have a similar request. I need to change the background color of the radComboBox (or perhaps the color of the text of the selected item) when the selected item's value is equal to 0. How can I do this client and server side? I Need both as I need to preset the color and resond to client-side selections. Essentially I add an item to a generic List with an ID of 0 in the first position in the list and then bind to a radcombobox
When this item is selected (when the form first loads) and at any later time this item is selected I would like to make the combobox text red, and when unselected the text in the combo should be the default color.
The solution earlier shows the item in another color in the items list on dropdown, however does not affect the color after selection is complete
I have a similar request. I need to change the background color of the radComboBox (or perhaps the color of the text of the selected item) when the selected item's value is equal to 0. How can I do this client and server side? I Need both as I need to preset the color and resond to client-side selections. Essentially I add an item to a generic List with an ID of 0 in the first position in the list and then bind to a radcombobox
| List<Lookup> objLanguages = LookupService.GetAll("Language"); |
| objLanguages.Insert(0, new Language{Name="<Required>"}); |
| ddlPrimaryLanguage.DataSource = objLanguages; |
| ddlPrimaryLanguage.DataBind(); |
When this item is selected (when the form first loads) and at any later time this item is selected I would like to make the combobox text red, and when unselected the text in the combo should be the default color.
The solution earlier shows the item in another color in the items list on dropdown, however does not affect the color after selection is complete
0
Hi Jonathan,
I've attached a simple page demonstrating the needed approach. Please download it and give it a try.
All the best,
Yana
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.
I've attached a simple page demonstrating the needed approach. Please download it and give it a try.
All the best,
Yana
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
Jonathan
Top achievements
Rank 1
answered on 23 Jul 2009, 04:57 PM
Thanks Yana looks like it should do the trick :-)