Getting string message to the view from code behind

Goud.Kv
Posted by Goud.Kv under ASP.NET MVC category on | Points: 40 | Views : 1142
Below code snippet shows you how to transfer and display the string in the view from code behind,

In your controller of your application,

 public ActionResult Index()
{
ViewBag.Message = "Welcome to Gaming Zone";
return View();
}


And., Call that string in the view(Index)

@ViewBag.Message

Comments or Responses

Login to post response