setting the page title, meta info in a view in asp.net mvc 4

前端 未结 4 1718
不知归路
不知归路 2021-02-12 15:04

I am very new to MVC and I am updating a web form application to mvc. I have a shared layout (masterpage in webforms), I would like to set the meta and title information per vie

4条回答
  •  旧巷少年郎
    2021-02-12 15:38

    In your method of controller.

    ViewData["Title"] = "this is page one title";

    in you view, have this. @ViewData["Title"])

    if title is html, it should be @html.raw(ViewData["TopMessage"])

    Razor engine is better for mvc, so I recommend you try razor when you create a new project. hope it help you.

提交回复
热议问题