ASP. NET uses CSS to implement multiple interfaces.
Method 1:
<% @ Page Language = "C #" %>
<% @ Import namespace = "system. Data" %>
<Script language = "C #" runat = "server">
Public void page_load (Object OBJ, eventargs E)
{
// Create a server control.
// The specified tag "Link" initializes a new instance of this type.
Htmlgenericcontrol objlink = new htmlgenericcontrol ("Link ");
Objlink. ID = ID;
Objlink. attributes ["rel"] = "stylesheet ";
Objlink. attributes ["type"] = "text/CSS ";
Objlink. attributes ["href"] = "portal.css ";
// This control does not produce any visible output. It is only used as a container for other controls. You can add, insert, or remove controls in it.
Mycss. Controls. Add (objlink );
}
</SCRIPT>
<HTML>
<Head>
<Title> C # </title>
<Asp: placeholder id = "mycss" runat = "server"> </ASP: placeholder>
</Head>
<Body bgcolor = "# ffcc66" style = "Font: 9pt">
<Form runat = "server">
</Form>
</Body>
</Html> |
Method 2:
<% @ Page Language = "C #" %>
<SCRIPT runat = "server">
Protected void page_init (Object sender, eventargs E)
{
// Define an htmllink control.
Htmllink myhtmllink = new htmllink ();
Myhtmllink. href = "~ /Stylesheet.css ";
Myhtmllink. Attributes. Add ("rel", "stylesheet ");
Myhtmllink. Attributes. Add ("type", "text/CSS ");
// Add the htmllink to the head section of the page.
Page. header. Controls. Add (myhtmllink );
}
</SCRIPT>