I created a project and in it worked hard and created many models, views and controllers. All worked great. I decided to rename one of my models, and accordingly rename my controller and view thinking it would all continue to work great. This is because I wanted to use the origional name for something more appriopriate later. For example.
Old Names:
MyOldModel
MyOldController
MyOldView
Were renamed to:
MyNewModel
MyNewController
MyNewView
Now all still works great execpt that when I click the link to my new view my program looks for and tries to show MyOldView which obviously does not exist. However when I manually put in /MyNewView it works.
How do I change my controller to look for the Index in the MyNewView folder instead of looking for the Index in the MyOldView folder.
I even tried deleting and recreating the controller to no avail.
Thanks in advance for any help.
Edit: To those who have been kind enough to reply so quickly something to note:
The exact steps taken were:
1. Rename the model file from MyOldModel.cs to MyNewModel.cs
2. Rename the controller file from MyOldController.cs to MyNewController.cs
3. Renamed the FOLDER on the view (which only contains Index.cshtml)
from MyOldView to MyNewView
4. At each step visual studio prompted me to rename all refrences to the object being renamed and I accepted (said yes). So the class names all got updated correctly. From what I can see at least, so did all the other refrences.
According to what is being said here, it should be working.
I simply renamed the
As requested by the op, my comment as an answer:
check that your _Layout points to the right views also from button clicks otherwise it will still be searching for the old controllers/views when you have replaced/renamed them with the new controllers/views, glad to be of assistance!