日期:2014-05-17  浏览次数:20475 次

如何动态切换css 出现问题
public static void SwitchCSS(Page page, string CSSFilePath)
  {
  HtmlLink link = new HtmlLink();
  link.Href = CSSFilePath;
  link.Attributes["rel"] = "stylesheet";
  link.Attributes["type"] = "text/css";
  if (page != null) 
  {
  page.Header.Controls.Add(link);
  }  
  }


错误!!!!!!!!!!!!!!!
Object reference not set to an instance of an object.
不知道是link那里出现了什么问题~~~

------解决方案--------------------
head在你的母版页里面。BaseLayout.Master页面里面。