4

I need to create a simple view with 3 links on it ( Administration type page ), I tried adding a View called index to a Directory called Administration but when I try to navigate to it it throws a resource not found error. I am brand new to MVC coming from Web Forms so sorry if this is a stupid question ;)

2 Answers 2

7

Firts Add a controller which will come with Index method. Right click on Index Method and select Add View. Add all Html you want to add in that view and your page is ready without adding a Model.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! I really am liking MVC versus web forms, I wish I would have gotten into it sooner ;)
2

You need to have a controller to render the view.

For instance, if you had an AdminController with a method similar to something like public ActionResult Index() { return View(); } this would render the index view where you could place your html/links etc.

The view itself doesn't need a model this way as you are not supplying anything when returning the View().

You could then navigate to the page by http://xxx/Admin/Index or, 'http://xxx/Admin/'.

It is well worth looking around SO and other various websites for MVC queries!

Good luck.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.