Binding to Color

  • Thread starter Thread starter Dennis
  • Start date Start date
D

Dennis

I have a table that has color text (Red, Blue...) as values and want to bind
items to it. If I bind a linkbutton's Text property it displays the text,
but when bound to Forecolor, I get the attached error. I want an object's
fore/background colors to bind properly to a table.

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
 
You need to visit the aspnet newsgroups for this.

Regards - OHM

I have a table that has color text (Red, Blue...) as values and want
to bind items to it. If I bind a linkbutton's Text property it
displays the text, but when bound to Forecolor, I get the attached
error. I want an object's fore/background colors to bind properly to
a table.

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

Best Regards - OHMBest Regards - OHM (e-mail address removed)
 
* "Dennis said:
I have a table that has color text (Red, Blue...) as values and want to bind
items to it. If I bind a linkbutton's Text property it displays the text,
but when bound to Forecolor, I get the attached error. I want an object's
fore/background colors to bind properly to a table. [...]
Text='<%# DataBinder.Eval(Container, "DataItem.BGColor") %>'
CommandArgument='<%# DataBinder.Eval(Container, "DataItem.ContractID") %>'
ForeColor='<%# DataBinder.Eval(Container, "DataItem.BGColor") %>'>

You may want to ask questions like this in the ASP.NET group:

<
Web interface:

<http://msdn.microsoft.com/newsgroup...roup=microsoft.public.dotnet.framework.aspnet>
 
Back
Top