Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Currently I'm Using Style1.css in my page..
but what i need is,
at the running time of my page.. when user clicks a button i need to change Style1.css to Style2.css

Plz help me....
Posted

If you are using the them then change it in page_preInIt event. OR if you just want to change the css file (not using them ) then refer

Dynamically set a link to a CSS file in ASP.NET[^]
 
Share this answer
 
Comments
version_2.0 30-May-11 8:02am    
thanks...
you can use java script it can automatically change css

XML
<script type="text/javascript" language="javascript">
   
 var myWidth = 0, myHeight = 0;
 if( typeof( window.innerWidth ) == 'number' ) {
   //Non-IE
   myWidth = window.innerWidth;
   myHeight = window.innerHeight;
 } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
   //IE 6+ in 'standards compliant mode'
   myWidth = document.documentElement.clientWidth;
   myHeight = document.documentElement.clientHeight;
 } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
   //IE 4 compatible
   myWidth = document.body.clientWidth;
   myHeight = document.body.clientHeight;
 }
           if (myWidth <=800)
           {
           document.write('<link href="App_Themes/Theme1/Css/Main800.css" rel="stylesheet" type="text/css" />');
           }
           if (myWidth <= 1024)
           {
           document.write('<link href="App_Themes/Theme1/Css/Main1024.css" rel="stylesheet" type="text/css" />');
           }
           if (myWidth >=1024)
           {
           document.write('<link rel="stylesheet" type="text/css" href="App_Themes/Theme1/Css/Main1280.css" />');
           }
           if (myWidth = 0) {
               document.write('<link rel="stylesheet" type="text/css" href="App_Themes/Theme1/Css/Main1024.css" />');
           }

 </script>
 
Share this answer
 
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900