Action method:
public ActionResult test()
{
ViewBag.aa = "hello <b>ali</b>";
return View();
}
View:
@ViewBag.aa
Output:
hello <b>ali</b>
But I want ali in bold like following:
hello ali
Try using @Html.Raw(...
ViewBag.aa = "hello <b>ali</b>";
In view
@Html.Raw(ViewBag.aa)
For more check C# Razor Syntax Quick Reference