I wrote this code below to set a theme for the selected value from the list, it works for this page:
protected void Page_Init(object sender, EventArgs e)
{
HttpCookie c = Request.Cookies["theme"];
Page.Theme = c == null ? "Aqua" : c.Value;
}
protected void Page_Load(object sender, EventArgs e)
{
HttpCookie c = Request.Cookies["theme"];
if (!IsPostBack && (c != null))
rbList.Value = c.Value;
}
Problem: I want to apply the same theme to all other pages for which I wrote a function Page_Initon pages where I want to apply a theme, but this one Page_Initdoes not work on the second page. Did I miss something?
Here is the code that I write on the second page:
protected void Page_Init(object sender, EventArgs e)
{
HttpCookie c = Request.Cookies["theme"];
Page.Theme = c == null ? "Aqua" : c.Value;
}
source
share