Solved

MVC Add View coresponding the controller

Posted on 2014-02-18
1
324 Views
Last Modified: 2014-02-19
Hi Expert,

I couldn't "Add View" by right-clicking in the View portion of the code as shown below.

   public ActionResult Index()
{
   return View();
}

I can add view but not related my helloworldcontroller.

I followed this tutorial and I Used visual studio 2010 and MVC2

http://www.asp.net/mvc/tutorials/older-versions/getting-started-with-mvc/getting-started-with-mvc-part3.


>>Let's now add a View template to our project that we can use for our Index() method. To do this, right-click with your mouse somewhere in the middle of the Index method and click Add View...


thanks.
0
Comment
Question by:dshi15
1 Comment
 
LVL 23

Accepted Solution

by:
Ioannis Paraskevopoulos earned 500 total points
ID: 39869994
You can manually add a view:

In the Solution Explorer right click on the 'Views' folder.
Select 'Add'->'Folder' and name it 'helloworld'. The name of the folder should be the same as the name of the controller when you remove the word 'controller'.
Then right click on your newly created folder and seletc 'Add'->'View'.
Now, if you name your view 'Index' then you are good to go. You may name it whatever you like, but then you should have:

    return View("YourViewName");

Open in new window


Giannis
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
firstChar challenge 13 110
python question 5 69
creating threads in delphi 1 82
Recommendation vb6 to vb.net or others 14 111
A short article about problems I had with the new location API and permissions in Marshmallow
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This video teaches users how to migrate an existing Wordpress website to a new domain.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now