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
Post a Comment