asp.net - Switch css files dynamically -


i trying switch css files dynamically in asp.net using c#.

when click on button1/ button2 code working fine , css file switching on/off, when open page css deactivated.

when refresh page css file deactivated.

example> home (deafault) ! ! contact

when click on about us, page opens, css file becomes deactivated , default 1 activated.

i want css file not deactivated if click on about us after switching css file.

please advise me.

below code have written in master page

<head> <link id="lnkcss" runat="server" href = "~/css/main-style.css.css"  rel="stylesheet" type="text/css" /> </head>  <form>         <asp:button id="button1" runat="server" text="css 1" onclick="changecss" commandargument="theme1.css" />      <asp:button id="button2" runat="server" text="css 2" onclick="changecss" commandargument="theme2.css" />    </form> 

below code have written

protected void changecss(object sender, eventargs e) {     lnkcss.attributes["href"] = "~/css/" + (sender button).commandargument; } 

regards

you need perform post (or partial) retain selected css. allow other pages load selected css on default.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -