Create and pass list of string from Controller to View
HomeController.cs
{
public class HomeController : Controller
{
public ActionResult VBDemoPassingListofStr() // ViewBagDemo
{
List
ViewBag.countries = lstofCountries;
return View();
}
}
}
VBDemoPassingListofStr.cshtml
@{
ViewBag.Title = "VBDemoPassingListofStr";
}
ViewBag.Title = "VBDemoPassingListofStr";
}
@country
@foreach (string country in @ViewBag.countries)
{
}
- http://localhost:81/MvcVersionFinder/home/VBDemoPassingListofStr
VBDemoPassingListofStr
• India
• Germany
• England
No comments:
Post a Comment