First time question - Binding to color properties

D

Dennis J

I have a table that has color text (Red, Blue...) as values and want to bind
the background (or fg) properties to the column. If I bind a linkbutton's
Text property it displays the text,
but when bound to Forecolor, I get an error ("Specified cast is not valid").
I want an object's
fore/background colors to bind properly to a table. It seems that it wants
the values cast to "system.color" from text and I don't know how to make
that conversion. Or there it something else?

Thank,
DJ


Server Error in '/AWM' Application.
----------------------------------------------------------------------------
----

Specified cast is not valid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.InvalidCastException: Specified cast is not valid.

Source Error:

Line 42: </asp:Label></TD>
Line 43: <TD>
Line 44: <asp:LinkButton id=lb1 runat="server" Width="10px"
Text='<%# DataBinder.Eval(Container, "DataItem.BGColor") %>'
CommandArgument='<%# DataBinder.Eval(Container, "DataItem.ContractID") %>'
ForeColor='<%# DataBinder.Eval(Container, "DataItem.BGColor") %>'>
Line 45: </asp:LinkButton></TD>
Line 46: <TD>

Source File: c:\inetpub\wwwroot\AWM\Contracts\ScheduleYr.aspx Line: 44
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top