0

Here my code :

protected override void OnPreInit(EventArgs e)
 
  {
 
     
 

base.OnPreInit(e);
 
     
 

switch (Session["role"].ToString())
 
      {
 
         
 

case "X":
 
              MasterPageFile =
 

"X.Master";
 
             
 

break;
 
         
 

case "SS":
 
              MasterPageFile =
 

"SS.Master";
 
             
 

break;
 
 
 
default:
 
              MasterPageFile =
 

"XS.Master";
 
             
 

break;
 
      }
 
    
 

if (Session["role"].ToString() == "SS")
 
      
 
         {     btnSearch.Enabled =
 

true;
 
                rbSerial.Checked =
 

false;
 
                rbName.Checked =
 

false;
 
             }
 
        
 

else 

           {
 
               btnSearch.Enabled =
 

false;
 
           
 
             }
 
            
 
      }
 
 ..
 
please advice
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by skatamatic
0

Hmmm I am not too sure when the event OnPreInit fires but I suspect it is prior to any control init code (hence, on preinitialization). Try putting the code in a different event that fires on load, but after the control initialization (such as OnLoad or something similar). Bascially your .Enabled values are being overwritten by the initialization properties (the ones you set in the IDE)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.