Nate
Nate

Reputation: 2084

asp.net MVC3 View

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?

Upvotes: 0

Views: 76

Answers (2)

Alex
Alex

Reputation: 35399

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...

Upvotes: 4

Illuminati
Illuminati

Reputation: 4619

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.

Upvotes: 1

Related Questions