Watch this example on YouTube
1. create method that will receive some arguments
public ActionResult DisplayMessage(string city, int age)
{
ViewBag.City = city;
ViewBag.Age = age;
return View();
}
2. Add view and the following code to it
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
@{
<p>The following city: @ViewBag.City is @ViewBag.Age years old.</p>
}
No comments:
Post a Comment