tags:

views:

11

answers:

1

Hello All,

In my controller class I have stored some text in the ViewData which will be visible to the user after postback.I want to give color to the text stored in that viewdata.Please tell me how can I do this.

ForExample: ViewData["msg"] = "Product sampling added successfully";

How to give black color to the text product sampling added successfullly.

Thank You in Advance Ritz

A: 

Strings in and of themselves do not have display properties such as colour, they are just UTF-16 encoded character data. So you cannot give the text itself a colour. Presumably you mean that you wish to display a web page with the text in a specific colour, in which case simply add a setting containing this which the page can use during rendering, for example:

ViewData["message_color"] = "black";
Greg Beech