熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp.net動態加載css

2022-06-13   來源: .NET編程 

  誰如果有更直接的方法請不吝賜教也不知有什麼方法可以直接更換css

  <%@ Page Language=C# AutoEventWireup=true  CodeFile=Defaultaspxcs Inherits=_Default %>

  <!DOCTYPE html PUBLIC //WC//DTD XHTML Transitional//EN transitionaldtd>

  <html xmlns= >

  <head runat=server>

  <title>紅色莊重</title>

  <link rel=stylesheet type=text/css />

  <asp:placeholder runat=server ID=phCss></asp:placeholder>

  </head>

  <body>

  <form id=form runat=server>

  </form>

  </body>

  </html>

  using System;

  using SystemData;

  using SystemConfiguration;

  using SystemWeb;

  using SystemWebSecurity;

  using SystemWebUI;

  using SystemWebUIWebControls;

  using SystemWebUIWebControlsWebParts;

  using SystemWebUIHtmlControls;

  public partial class _Default : SystemWebUIPage

  {

  protected void Page_Load(object sender EventArgs e)

  {

  if (!IsPostBack)

  BindCss();

  }

  private void BindCss()

  {

  HtmlGenericControl objLink = new HtmlGenericControl(LINK);

  objLinkAttributes[rel] = stylesheet;

  objLinkAttributes[type] = text/css;

  objLinkAttributes[href] = css/commoncss;

  phCssControlsAdd(objLink);

  }

  }


From:http://tw.wingwit.com/Article/program/net/201311/13094.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.