0

I want to open a view that says update or insert successful. I did not create an action because I only want a simply status page. I created a view called Status.cshtml I get a message saying that the view cannot be found. Any idea what is wrong? Do I need an action for this to work?

Dan Esparza
  • 28,047
  • 29
  • 99
  • 127
Nate
  • 2,044
  • 4
  • 23
  • 47
  • 3
    1: Please accept answers for your past questions. 2: Please provide enough code to give us an idea of how you're trying to invoke the view now. – StriplingWarrior Jul 18 '11 at 17:57
  • Can you provide code from your controller? – Dirk Jul 18 '11 at 17:57
  • possible duplicate of [asp.net mvc utilize view for rendering, without creating a controller action](http://stackoverflow.com/questions/4056308/asp-net-mvc-utilize-view-for-rendering-without-creating-a-controller-action) – Dan Esparza Jul 18 '11 at 17:59

2 Answers2

4

When your process has finished successfully use the following line of code...

return View("Status");

Note: There is no action method with the same name - so navigating to www.yourdomain.com/YourController/Status will not route correctly...

Alex
  • 34,899
  • 5
  • 77
  • 90
1

Just a View is not enough. Your request first reaches a controller action through Asp.net mvc routing and only if the correct action is found the relevant view is displayed. Here is a video if you need a quick grab of how asp.net controllers and views work.

Illuminati
  • 4,539
  • 2
  • 35
  • 55