My situation may be slightly different than yours in that my application has
just one page and I dynamically load user controls based on user input,
security settings, etc.
The first part of my Page.aspx looks something like this;
<%@ Page language="c#" Codebehind="Page.aspx.cs" AutoEventWireup="false"
Inherits="Portal.Page" %>
<HTML>
<HEAD>
<title><%=PageTitle%></title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
<%=OutputCss()%>
</HEAD>
....
</HTML>
Where OutputCss is a member of BasePage;
protected string OutputCss()
{
// Generate a bunch of link tags or even <style> elements
// (actually you could return anything that's valid in the <head>)
return aBunchOfLinkTags;
}
"David Young" wrote:
Thanks,
Now, I see that there is no way to access the documents stylesheet directly.
So, would I have to override the pre init and write out my <link> tag there?
Dave
"Brad Quinn" <Br*******@discussions.microsoft.com> wrote in message
news:0A**********************************@microsof t.com... Yes, you should be putting anything repetitive in a BasePage class derived
from Page. Thet way the BasePage can be concerned with things like
stylesheets.
I've even implemented asynchronous page handling in my BasePage without
having to modify any code in the derived Pages.
"David Young" wrote:
I normally work on WinForms projects, but have been recently thrust into
this arena and had a questions concering access to objects stored in
session.
We've apparently got an object (custom class) that's stored in session for each user of our app. This object provides information related to the use and their environment, as well as default data used in the system. One of these items is a reference to the stylesheet used for that user.
Rather than have each page in the site retrieve the object and process the stylesheet reference, I was thinking about having all pages inherit from a base page class that we write, that would automatically pull the object from session, get the stylesheet reference and embed the <link> tag in the header of the page.
Is that do able? Is there something else that I should be looking at doing? Any suggestions?
Thanks, Dave