开发者

Creating Menus in asp.net MVC

开发者 https://www.devze.com 2023-01-20 19:13 出处:网络
I want create menu item in asp.net MVC just as like as home and about us.I tried adding following code in \"Site.Master\" page.

I want create menu item in asp.net MVC just as like as home and about us.I tried adding following code in "Site.Master" page.

  • <%: Html.ActionLink("Patners","Patner","Home") %>
  • And I've created one view called "patner" by right clicking on "Home" folder in solution explorer and checking the check box of "create strongly-typed view" and view content is "Empty". But it's giving error. How can I add a men开发者_如何学Pythonu?


    When you create a strongly typed view, the controller action rendering this view needs to pass a model:

    public class HomeController: Controller
    {
        public ActionResult Patner()
        {
            var model = new SomeModelTheViewIsStronglyTypedTo();
            return View(model);
        }
    }
    

    And in ~/Views/Home/Partner.aspx:

    <%@ Page 
        Language="C#" 
        Inherits="System.Web.Mvc.ViewPage<Some.SomeModelTheViewIsStronglyTypedTo>" 
    %>
    
    0

    精彩评论

    暂无评论...
    验证码 换一张
    取 消