Skip to content
Loading
Temp Data in HTML.
  • Mageshwaran R
    Hi Sourabh Dhiman,
     Use ViewBag,
     
    Controller:
     
    1. public class HomeController : Controller    
    2.    {    
    3.         
    4.        public ActionResult Index()    
    5.        {    
    6.          ViewBag.Name = "Sourabh Dhiman";    
    7.          return View();  
    8.             
    9.        }    
    10.         
    11.               
    12.        }    
     Razor page:
     
    1. @{    
    2.     ViewBag.Title = "Index";    
    3. }    
    4.     
    5. <head>    
    6.     <title>@ViewBag.Titletitle>    
    7. head>    
    8.     
    9. <body style="text-align:center">    
    10.       <p>Name:>@ViewBag.Name    
    11.       
    12. body>