Method 1: <Title> webform1 </title>
<LINK rel = "stylesheet" type = "text/CSS" href = "" id = "mycss">
</Head>
Private void button#click (Object sender, system. eventargs E)
{Page. registerstartupscript ("CSS", @ "<SCRIPT> mycss.stylesheet.addimport('stylesheet1.css ') </SCRIPT> ");
}
Method 2: --- method of playing... copied... <Title> webform1 </title>
<Asp: placeholder id = "myplaceholder" runat = "server"> </ASP: placeholder>
</Head>
Private void button2_click (Object sender, system. eventargs E)
{
System. Web. UI. control a = page. findcontrol ("myplaceholder ");
System. Web. UI. htmlcontrols. htmlgenericcontrol objlink = new htmlgenericcontrol ("Link ");
Objlink. Attributes. Add ("rel", "stylesheet ");
Objlink. Attributes. Add ("type", "text/CSS ");
Objlink. Attributes. Add ("href", "stylesheet1.css ");
Objlink = objlink;
A. Controls. Add (objlink );
}
[Note] ASP: placeholder This control is mainly used as a placeholder"