在套用 MatserPage 的頁面中動態加入 CSS File

在套用 MatserPage 的頁面中動態加入 CSS File

程式碼:

  1. protected void Page_Load( object sender, EventArgs e)
  2. {
  3. HtmlLink csslink = new HtmlLink( );
  4. csslink.Href = "~/CSS/PageA.css";
  5. csslink.Attributes.Add ( "rel", "stylesheet" );
  6. csslink.Attributes.Add ( "type", "text/css" );
  7. Header.Controls.Add (csslink);
  8. }