开发者

How to give color to the text stored in viewdata?

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 add开发者_高级运维ed successfully";

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


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";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜