First time question - Binding to color properties

Discussion in 'ASP .Net' started by Dennis J, Dec 2, 2003.

  1. Dennis J

    Dennis J Guest

    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
    Dennis J, Dec 2, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Victor Porton
    Replies:
    1
    Views:
    697
    Steven T. Hatton
    Aug 29, 2004
  2. flamesrock
    Replies:
    8
    Views:
    451
    Hendrik van Rooyen
    Nov 24, 2006
  3. Peter

    properties not showing in properties window at design time

    Peter, Dec 10, 2003, in forum: ASP .Net Building Controls
    Replies:
    1
    Views:
    209
    Lostinet.Web Support
    Dec 10, 2003
  4. JcFx
    Replies:
    0
    Views:
    276
  5. Kamaljeet Saini
    Replies:
    0
    Views:
    411
    Kamaljeet Saini
    Feb 13, 2009
Loading...

Share This Page