// Introduce the JS File
Htmlgenericcontrol scriptcontrol = new htmlgenericcontrol ("script ");
Scriptcontrol. Attributes. Add ("type", "text/JavaScript ");
Scriptcontrol. Attributes. Add ("language", "JavaScript ");
Scriptcontrol. Attributes. Add ("src", "../JS/menu. js ");
Page. header. Controls. Add (scriptcontrol );
// Introduce the style sheet
Literal csscontrol = new literal ();
Csscontrol. Text = "<link href = \" ../CSS/menu.css \ "rel = \" stylesheet \ "type = \" text/CSS \ "/> ";
Page. header. Controls. Add (csscontrol );
JS introduction can also be used:
If (! Page. clientscript. isclientscriptincluderegistered ("menu "))
Page. clientscript. registerclientscriptinclude (this. GetType (), "menu ",
Page. resolveclienturl (@"~ /Menu. js "));
The page class has a lot of things ~
This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/nailwl/archive/2009/06/30/4308832.aspx