RachelW
4Penny.net
Points: 7053

6/16/2020 11:43:49 AM

Change a control color in the aspx page

* This article, and all our great Telerik ASP.NET documentation, Is available on the Telerik ASP.NET menu

Usually, when I want to affect the appearance of an ASP.NET control, specifically a Telerik control, I'll trap the ItemDataBound event and get it there. 

But doing that involves a multi step process. I'm trying a new approach, changing it using my stored procedure and the aspx page. No code behind. 

The approach involves having a SQL field that specifies the color, and setting the FORECOLOR.

But...

This control will accept this

<telerik:RadButton  CssClass="Bold" ID="btnTakeoff" commandName="Takeoff" runat="server" Text='Takeoff' ForeColor='#FF0000' ></telerik:RadButton>

but not this

<telerik:RadButton  CssClass="Bold" ID="btnTakeoff" commandName="Takeoff" runat="server" Text='Takeoff' ForeColor='<%# Eval("buttoncolor") %>' ></telerik:RadButton>

It throws an invalid conversion error

Solution below

4Penny.net
Version: All
Section: Telerik
Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3