You need to use Session for this and check session data in page load
Ref:
Dynamically change (switch) CSS file programmatically from code behind in ASP.Net
Master page:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<link id="lnkCSS" runat="server" href="~/CSS/Css1.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="btnRadio">
<asp:RadioButtonList ID="rblThemes" runat="server" RepeatDirection="Horizontal" AutoPostBack="true"
OnSelectedIndexChanged="themes_SelectedIndexChanged">
<asp:ListItem Text="Theme1" Value="Css1.css"></asp:ListItem>
<asp:ListItem Text="Theme2" Value="Css2.css"></asp:ListItem>
</asp:RadioButtonList>
<asp:RadioButtonList ID="masters" runat="server" RepeatDirection="Horizontal" AutoPostBack="true"
OnSelectedIndexChanged="masters_SelectedIndexChanged">
<asp:ListItem>Master1</asp:ListItem>
<asp:ListItem>Master2</asp:ListItem>
</asp:RadioButtonList>
</div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
Master.cs
protected void Page_Load(object sender, EventArgs e)
{
if (Session["SelectedCss"] != null)
{
lnkCSS.Attributes["href"] = "~/CSS/" + Session["SelectedCss"].ToString();
}
}
protected void themes_SelectedIndexChanged(object sender, EventArgs e)
{
lnkCSS.Attributes["href"] = "~/CSS/" + this.rblThemes.SelectedItem.Value;
Session["SelectedCss"] = this.rblThemes.SelectedItem.Value;
}
protected void masters_SelectedIndexChanged(object sender, EventArgs e)
{
}
Default.aspx
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:Label ID="Label1" runat="server" Text="This is a Label" CssClass="label"></asp:Label>
<asp:Button ID="Button1" Text="Second Page" OnClick="Redirect" runat="server" />
</asp:Content>
Default.aspx.cs
protected void Redirect(object sender, EventArgs e)
{
Response.Redirect("~/Default2.aspx");
}
Default2.aspx:
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:Label ID="Label1" runat="server" Text="This is a Label" CssClass="label"></asp:Label>
<asp:Button ID="Button1" Text="First Page" OnClick="Redirect" runat="server" />
</asp:Content>
Default2.aspx.cs
protected void Redirect(object sender, EventArgs e)
{
Response.Redirect("~/Default.aspx");
}
Css1.css
body { font-family:Arial; font-size:10pt; }
.label { font-weight:bold; color:Red; }
Css2.css
body { font-family:Arial; font-size:10pt; }
.label { font-weight:bold; color:Blue; }