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

Calendar in Asp.net

CheckBox in Asp.Net MVC (Insert Data of CheckBox in Database and GetData Of checkBox From DataBase)