切換CSS換皮膚

來源:互聯網
上載者:User

 

protected override void Render(System.Web.UI.HtmlTextWriter writer) 
   { 
   StringWriter sw = new StringWriter() ; 
   HtmlTextWriter htmlWriter = new HtmlTextWriter(sw) ; 
   
   base.Render(htmlWriter) ; 
   //目前使用者選擇的風格css 
   string css = "<link href=\"css url\" rel=\"stylesheet\" type=\"text/css\">" ; 
   
   string html = sw.ToString() ; 
   int startPoint = html.IndexOf("</head>", StringComparison.CurrentCultureIgnoreCase); 
   if (startPoint > 0) 
   { 
   html = html.Insert(startPoint, css); 
   } 
   
   writer.Write(html) ; 
   } 
相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.