G
Geossl
Dear All,
I try to change a master page in the OnPreInit in a asp.net page.
(Session variable is guaranteed to have been assigned)
protected override void OnPreInit(EventArgs e){
if ((bool)session["IsNew"]){
this.MasterPageFile = "~/NewMaster.master";
}
else{
this.MasterPageFile = "~/OrigianlMaster.master";
}
base.OnPreInit(e)
}
But after this, the page does not trigger any other event. I try to trace to
the problem , and when I remove the casting of the session variable,
if ((bool)session["IsNew"]){
to
if (session["IsNew"] == null)
then, everything works fine again.
Why casting a session variable will inhibit the triggering of other events
in the page??
I try to change a master page in the OnPreInit in a asp.net page.
(Session variable is guaranteed to have been assigned)
protected override void OnPreInit(EventArgs e){
if ((bool)session["IsNew"]){
this.MasterPageFile = "~/NewMaster.master";
}
else{
this.MasterPageFile = "~/OrigianlMaster.master";
}
base.OnPreInit(e)
}
But after this, the page does not trigger any other event. I try to trace to
the problem , and when I remove the casting of the session variable,
if ((bool)session["IsNew"]){
to
if (session["IsNew"] == null)
then, everything works fine again.
Why casting a session variable will inhibit the triggering of other events
in the page??