Reputation: 63
I wish to apply text colouring to only part of a ASP.net table cell's text value.
Currently, my code looks like this:
string BeneficiaryName = "ABCD";
string status = "Active";
tblcell = new TableCell();
if(status == "Active")
{
tblcell.Text = BeneficiaryName + " " + status ;
}
This sets the cell text to have both BenficiaryName and status variables combined, but I want the "status" value to appear with a green colour.
How could I achieve this?
Upvotes: 0
Views: 698
Reputation: 5068
Try adding a style directly to the text.
tblcell.Text = BeneficiaryName + " <span style='color: green;'>" + status + "</span>";
Upvotes: 1