ViewBag Example in MVC

Use Of  ViewBag

Code

[Route("ViewBag")]
        public ActionResult mymethod2()
        {
            ViewBag.mybag = "Hello my View bag Example";
            return View();
        }

CsHTML


<h2>mymethod2</h2>
@ViewBag.mybag
@ViewData["viewdata"]

Comments

Popular posts from this blog

Search Record From Table Using jQuery in Asp.net core MVC

How To insert Radio Button Data in DataBase -- MVC

Toolbox Webparts Controls