I am using the RadCheckBoxList and I want to color an individual ButtonListItem.
The attributes propery is not available, so I am not able to set the styling of an individual item.
RadCheckBoxList radCheckBoxList = (RadCheckBoxList)radPanelItem.Items.FindControl("radCheckBoxList");
The property is available when you use the regular System.Web.UI.WebControls.CheckBoxList control.
Any idea how to set the color of an individual item?
7 Answers, 1 is accepted
There is a client-side solution only that I can provide:
Telerik by Progress
Thanx for the quick reply!
Is there a chance the Attributes property will be added to the RadCheckBoxList control in the near future?
You are welcome, Marcel!
Presently, there aren't plans for an Attributes collection property but you can file a feature request in our feedback portal: https://feedback.telerik.com/Project/108.Kind regards,
Telerik by Progress
sender.get_items()._element.firstChild.style.color = "red";
How do I also change the color of the text?
You can apply a color to the item text via sender.get_items()._element.children.style.color = "red";
I hope this helps!
This is the content translated by Google. If the grammar is incorrect, please splice it yourself, sorry.
After searching for a long time, I finally found this great answer, but because my colors and other styles want to be dynamic, is there a way to fill in the css file directly?
And I will fill in the different css file name for each item in the OnDataBound event.
I hope you are doing good!
For the time being, the telerik:RadCheckBoxList control does not offer API for fine-tuning its appearance and that why I proposed a client-side solution to achieve the coloring through the DOM. You can provide the colors via a hidden field from the server and set them on the client.
Please log a feature request so that we can plan its implementation for a subsequent release.
Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.