在我的站点中,我对MVC视图和WebForm页面都有相同的WebForm。
我想在后面的ViewData代码中使用MasterPage。
我有个例外:
ViewMasterPage只能用于从ViewPage或ViewPage.派生的内容页。
public partial class MasterPage : System.Web.Mvc.ViewMasterPage{
protected void Page_Load(object sender, EventArgs e)
{
ViewData["X"] = "data";这个代码在一个System.Web.Mvc.ViewPage
ViewData需要是页面中的同一个对象,而后面的masterPages代码。
谢谢
拉斐尔。
发布于 2011-05-03 10:49:04
对于您的目的来说,它可能并不理想,但是在运行MVC或WebForms视图或后面的代码时,确实存在且易于访问的一个属性包是HttpContext.Items字典。
https://stackoverflow.com/questions/5771323
复制相似问题