Problem with asp button postback
Hi.
I have four buttons for changing stylesheet with IDs BTN_RED, BTN_GREEN, BTN_BLUE, BTN_YELLOW.
When I click one of them, I want to post back to this page while theme is changed.
I want to change href attribute of stylesheet, to corresponding stylesheet.
Here's master page cs file: (LINK_StyleSheet is id of link tag in header)
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Theme"] == null)
LINK_StyleSheet.Href = "~/Styles/blue.css";
else
LINK_StyleSheet.Href = Session["Theme"].ToString();
}
protected void BTN_RED_Click(object sender, EventArgs e)
{
Session["Theme"] = "~/Styles/red.css";
}
and also for three other buttons.
But site theme will change when I click a single button two times.
First time I click a button, it does not change the theme. second time, I click that, it will change.
What's the problem.