asp.net - MVC 3 Menu navigating to /Gap not /Home/Gap -


please accept apologies possible simplicity of question new mvc 3 , attempting learn through doing. have created new view named gap within application cannot figure out how reference page top menu. keeps navigating /home/gap not work.

                <ul id="menu">                     <li>@html.actionlink("home", "index", "home")</li>                     <li>@html.actionlink("gap", "gap")</li>                     <li>@html.actionlink("about", "about", "home")</li>                 </ul> 

assuming receive http 404 error saying not work, need create action return view user.

<ul id="menu">      <li>@html.actionlink("home", "index", "home")</li>      <li>@html.actionlink("gap", "gap", "home")</li>      <li>@html.actionlink("about", "about", "home")</li> </ul> 

you need action each of views.

namespace management.controllers {      public class homecontroller: controller      {               //           // get: /home/            public actionresult index()           {               return view();           }            //           // get: /home/about            public actionresult about()           {               return view();           }            //           // get: /home/gap            public actionresult gap()           {               return view("~/views/_portnumnber_/gap.cshtml");           }     } } 

without action methods cannot access views, how mvc works.

i advise reading tutorials here. place start.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -