How To Create View?
Step1:- Add new action method inside the controller class
Step 2:Right click on the View() method and select ‘AddView’
Step 3:- Add View dialog has option to mention the strongly type view, masterpage etc which will be discussed in later and click ‘Add’
Step 4:Views files are added to the folder in the solution explorer.
Congratulations! Now you have successfully created the View.
public class HomeController : Controller { public class Employee { public string Name; public int Age; } List empList = new List { new Employee { Name = "Santosh Kumar Singh", Age=25}, new Employee { Name = "Reena kumari", Age=22}, new Employee { Name = "Gagan", Age=26 } }; public ActionResult Organization() { return View(); } }
Step 2:Right click on the View() method and select ‘AddView’
Step 3:- Add View dialog has option to mention the strongly type view, masterpage etc which will be discussed in later and click ‘Add’
Step 4:Views files are added to the folder in the solution explorer.
Congratulations! Now you have successfully created the View.