Reputation: 91
I am developing an ASP.NET website where I have TextArea and I need to set different color for each line.
I have the following in my code:
for (int j = 0; j < Max_Senses; j++)
{
for (int k = 0; k < n; k++)
{
if (j == 0) //first line black
TextArea1.Attributes["Style"] = "FONT-FAMILY: ''consolas';FONT-STYLE:bold; COLOR: Black; BACKGROUND-COLOR: White";
else // other lines red
TextArea1.Attributes["Style"] = "FONT-FAMILY: 'consolas';FONT-STYLE:bold; COLOR: Red; BACKGROUND-COLOR: White";
TextArea1.Value += res[k, j].PadRight(11);
}
TextArea1.Value += "\r\n";
}
It displays all lines with red while I need the first line to be colored black! Can anybody tell me how to solve this issue?
Upvotes: 0
Views: 833
Reputation: 190976
The HTML TextArea
does not support this. You likely will need a control that supports ContentEditable
, like CKEditor
Upvotes: 4