Loading ...

'System.Web.UI.WebControls.Literal' does not have a public property named 'ForeColor'.

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  web forms / data controls   » 'System.Web.UI.WebControls.Literal' does not have a public property named 'ForeColor'.

'System.Web.UI.WebControls.Literal' does not have a public property named 'ForeColor'.

Posts under the topic: 'System.Web.UI.WebControls.Literal' does not have a public property named 'ForeColor'.

Posted: 7/3/2010

Lurker 235  points  Lurker
  • Joined on: 10/16/2009
  • Posts: 47

Hi,

I am using literal control on my page but I am getting this error.

 'System.Web.UI.WebControls.Literal' does not have a public property named 'ForeColor'.

 

Please help me.


Posted: 7/3/2010

Professional 8495  points  Professional
  • Joined on: 5/3/2010
  • Posts: 389
  Answered

There are no such Color properties for Literal control, like ForeColor, BackColor.

It's intended to display text and plain html. You can add color of your HTML inside literal like this

Literal1.Text = "<font color='red'> Hajan </font>";


Posted: 7/3/2010

Guru 16518  points  Guru
  • Joined on: 4/19/2009
  • Posts: 483
  Answered

Hi Kevin,

Please go with "Label" control instead of "Literal" then.

 


Page 1 of 1 (3 items)