如何动态地设置母版页?动态、母版

2023-09-03 06:32:54 作者:江上清风

我已经要求我在其中要设置不同的母版页为根据用户ID同一页(即一个用户必须设置一个主网页,另一个用户必须设置另外一个主机)。可我们设置不同的母版页的任何页面动态?请帮助...

解决方案

 无效PAGE_ preINIT(对象发件人,EventArgs的)
{
    this.MasterPageFile =〜/ MyMaster.master;
}
 

说明::您可以动态地附加一个母版页到内容页面。由于母版页和内容页都在页面处理的初始化阶段合并后,母版页必须在此之前进行分配。通常情况下,您在preINIT级动态分配母版页。

I have requirement in which i want to set different Master Pages for the Same Page depending upon userid(i.e. for one user it must set one master page and for another user it must set another master ).Can we set different Master pages for any page dynamically?Please help...

解决方案 怎样在PPT中设置一张带有图片的母版幻灯片

void Page_PreInit(Object sender, EventArgs e)
{
    this.MasterPageFile = "~/MyMaster.master";
}

Explanation: You can attach a master page dynamically to a content page. Because the master page and content page are merged during the initialization stage of page processing, a master page must be assigned before then. Typically, you assign a master page dynamically during the PreInit stage.