File->New Project->Select the template
ASP.NET MVC4 Web Application
Select the type of Template
And Click On OK Button
Now I want to create a page without using Master Page.
Master page is located at the following location
By default one master page is created, so now I want to create a page without using that default master page or any other master page which is created by you.
Now go to controller
And right click on Controller and Select Add Controller and Give the name as Default Controller.
And Click on Add Button
By default one Method is created for Every Controller.
So every controller by default has this Method Index (). So whenever we run this Controller by Default Index Method will Gets Executed. So now I want to create my own method and run that method by Default.
So now I have created my Own Method that Is Default Index (). So now the controller is ready. So we have to create a View for this Controller.
So go to Controller and Right click on Selected Method Name i.e. (Default Index)
And select Add View
And Click on Add Button
By default the same Name is used for View Also. (I.e. Default Index)
DefaultIndex.cs.html
So now the View is created without using the Master Page.
Now I want to Run, the View. So Go to RouteConfig
And set the Controller Name and the Method Name, so that when we run the Application by Default this View is displayed (this is similar to Set as Start Page in aspx)
Now Run the Application and See the output
No comments:
Post a Comment
Thank you for visiting my blog