在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
在页面中添加如下代码(Page_PreInit事件代码中动态设置模板,前提是在页面Action中将用户信息存到ViewData["USER"]了): <script runat="server"> //动态设置模板 protected void Page_PreInit(object sender, EventArgs e) { switch (ViewData.Eval("USER.roleid").ToString()) { case "1": this.Page.MasterPageFile = "~/Views/Shared/SuperAdmin.Master"; break; case "2": this.Page.MasterPageFile = "~/Views/Shared/Manager.Master"; break; default: this.Page.MasterPageFile = "~/Views/Shared/Default.Master"; break; } } </script> |
请发表评论