1,105,214 Community Members

How to add three Master Page

Member Avatar
uva1102
Light Poster
42 posts since Aug 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Hi everyone,

I wanted to add 3 Pages.. If Supervisor login will direct to supersior page, if engineer login will direct to engineer's page and so on.
Here is the code:

protected override void OnPreInit(EventArgs e) {
base.OnPreInit(e);
Page.MasterPageFile = (Session["role"].ToString() == "ME") ? "ME.Master" : "ME.Master";
}
protected List<preventiveRecord> listPrevRecord(string criteria) {
List<preventiveRecord> lpr = new List<preventiveRecord>();
switch (criteria) {
case "dueTomorrow": lpr = sdc.preventiveRecords.Where(a => a.preventive.Site == Session["site"].ToString() && a.Date_Due == DateTime.Today.AddDays(1) && a.Date_Done == null).ToList(); break;
case "allNearestFuture":
foreach (preventive p in sdc.preventives.Where(a => a.Site == Session["site"].ToString())) {
lpr.Add(p.preventiveRecords.Single(b => b.Date_Due == p.preventiveRecords.Where(a => a.Date_Due > DateTime.Today).Min(a => a.Date_Due)));
}
//lpr = sdc.preventiveRecords.Where(a => a.preventive.Site == Session["site"].ToString() && a.Date_Due > DateTime.Today).ToList();
break;
}
return lpr;
}

thanks and regards

Member Avatar
uva1102
Light Poster
42 posts since Aug 2011
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Im getting error..

namespace sys.CNS {
 public partial class ME0 : System.Web.UI.Page {
  sqlDataContext sdc = new sqlDataContext();
  protected override void OnPreInit(EventArgs e) {
   base.OnPreInit(e);
   switch (Session["role"].ToString())
   {
       case "1":
         MasterPageFile = "ME.Master";
           //break;
       case "2":
         MasterPageFile= "Spv.Master";
       case "3":
         MasterPageFile = "Mgr.Master";
       default:
         return ME0 ("default");

  }
You
This article has been dead for over three months: Start a new discussion instead
Post:
Start New Discussion
View similar articles that have also been tagged: