Wednesday, April 22, 2015

set master page dynamically to content page according to language value

To set Master Page dynamically according to language value field from cookie for example you should handle the event in  Page_PreInit event before controls rendered for the page

exmaple :

 void Page_PreInit(Object sender, EventArgs e)
    {
        if (Request.Cookies["CurrentLanguage"].Value.ToString().IndexOf("en-") == -1)
            this.MasterPageFile = "~/Print.master";
        else
            this.MasterPageFile = "~/PrintEN.master";
    }

No comments:

Post a Comment