Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
How to display master pages dynamically based on user
shshva
Jan 26 2012 1:19 AM
3.6k
Reply
Hi,
I have three roles engineer,supuvisor and manager for my website
and I have three master pages engineer.master , supervisor.master and mgr.master
and i have some specific aspx pages for engineer,supervisor and manager.
I want to use engineer.master page for an aspx page if engineer user is logged in and want to use supervisor.master page if supervisor logged in ans so on for the manager.
How can I achieve this?
Thanks in advance!!!
Im getting error
here is the code :
protected override void OnPreInit(EventArgs e) {
base.OnPreInit(e);
switch (Session["role"].ToString())
{
case "1":
MasterPageFile = "ME.Master";
break;
case "2":
MasterPageFile= "Supervisor.Master";
break;
case "3":
MasterPageFile = "Manager.Master";
break;
default:
MasterPageFile = "default.Master";
break;
}
Thank you
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
Web Control SDK and DDKs
Microsoft .Net Certifications