Saturday, August 22, 2009

How to change the Master Pages  in runtime....
1st add one column in ur table... name as varThemename (varchar(150))



then u can add this code to where ur masterpage is going to change




protected override void OnPreInit(EventArgs e)
{



string ThemeName;

cmd.commandtype=commandtype.text;
commandtype.text="select varTheme name from table name where id="1;


ThemeName= cmd.executescalar().tostring();






string masterfile = ThemeName;

if (!masterfile.Equals(string.Empty))
{
base.MasterPageFile = masterfile;
}
base.OnPreInit(e);
}
else
{
// Your Logik
}
}

No comments:

Post a Comment