-
C#代码
- public void AddPageHeaderLink(string virtualPath ,bool isJS)
- {
- System.Web.UI.HtmlControls.HtmlGenericControl link;
- if (!isJS)
- {
- link = new System.Web.UI.HtmlControls.HtmlGenericControl( "link" );
- link.Attributes.Add( "type", "text/css");
- link.Attributes.Add( "rel", "stylesheet");
- link.Attributes.Add( "href", virtualPath );
- }
- else
- {
- link = new System.Web.UI.HtmlControls.HtmlGenericControl( "script" );
- link.Attributes.Add( "language" , "javascript");
- link.Attributes.Add( "type", "text/javascript");
- link.Attributes.Add( "src", virtualPath );
- }
-
- Header.Controls.Add(link);
- }