开发者

Is there an equivalent to PageData for WebFormsView pages? Or is there a way to send instructions to the master page?

开发者 https://www.devze.com 2023-03-24 21:13 出处:网络
In MVC3, with WebViewP开发者_如何学Cages, there is the new property PageData which can be used to pass arguments to a parent layout page.

In MVC3, with WebViewP开发者_如何学Cages, there is the new property PageData which can be used to pass arguments to a parent layout page.

Unfortunately, we still have some legacy WebFormsView pages in our app and we want to have similar behavior, in being able to pass arguments to a parent master page. Is there a way to do this?


With MVC3 you can use the ViewBag to make data available to the master page.

E.g.

In View:

@{
    ViewBag.Title = "Home Page";
}

In Master Page:

<title>@ViewBag.Title</title>

Update:

Difference between PageData and ViewData


You can use the ViewBag.

0

精彩评论

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