Selecting CSS File From C#

W

william.oram

Using C# and ASP.NET 1.1, I seek to format a web page using a .css
file. Sparse documentation exists (see http://www.codeproject.com/aspnet/setcssfilelink.asp
and http://groups.google.com/group/micr....aspnet/browse_thread/thread/340475dcefdbd2a2
), but I can't seem to reproduce their results. I continue to get an
unformatted page.

My code, with impertinent parts removed:

// WebForm1.aspx
<HEAD>
<title>WebForm1</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">

<link id="MyStyleSheet" rel="stylesheet" type="text/css"
runat="server" />
</HEAD>

// code-behind
public class WebForm1 : System.Web.UI.Page
{
protected HtmlGenericControl MyStyleSheet;

private void Page_Load(object sender, System.EventArgs e)
{
MyStyleSheet.Attributes.Add("href","main.css");

// etc...
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top