tags:

views:

47

answers:

4

I am new to MVC.I have some doubts.

1) My MVC Application contains

 i)Default.aspx



   ii)Views
          ... Home
                    ... About.aspx
                    ... Index.aspx

during execution which one will load first Default.aspx ? or About.aspx?

2) I want to display a webpage that lists menu items (LinkButtons)as start page.For that do i need to design a View or web page ?

A: 

i think you should start reading asp.net mvc book first.

for, 1) default.aspx 2) whatever you like... but its upto you how you use it.....

martin
A: 
  1. Default.aspx is instrumented to allow routing. Don't remove it, but it won't actually display. The default route (as defined in Global.asax.cs) will be /home which translates to the index action on the home controller.

  2. Simply change the index view for the home controller. It is already set up as your "start" page.

tvanfosson
A: 

1) Depends on the routes define in global.asax but by default the Home controller and the index action will return index.aspx

2)You cam mix web forms and MVC but it's better to just stick with MVC unless you have good reason, so you should use a view,

You should head over to the mvc site, there are many good tutorials and examples.

Paul Creasey
+1  A: 

First, I would suggest reading up on how the Model-View-Controller pattern works.

To answer your questions:

  1. The Default.aspx file is for older versions of IIS that require a default document to start the ASP.NET MVC handler. IIS7 does this with a mapping in web.config. So, when you visit your MVC application, whichever route is configured as the default will load first. The .aspx files in the Views folder are, of course, your views. The content of these get returned by controller actions.

  2. ASP.NET MVC uses views, but I don't think there's anything preventing you from placing a plain old .aspx page somewhere. I wouldn't recommend it, though, because it's best to stick to the MVC pattern (that's what ASP.NET MVC is all about, after all). If you want to display your menu in more than one place, I would suggest a "partial view". If you want to display your menu on all pages, place it in a "master page".

David Brown