473,327 Members | 2,094 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Using a Stylesheet in a User Control

I have a user control that uses classes from a CSS Stylesheet. Because a
User Control does not have a <head> section, I do not know where to put a
link tag to link it to the stylesheet. If I manually place a a link tag in
the page that I use the User Control in it works fine, but is there a way to
have the control add this link tag for me when I insert the control? Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/
Nov 19 '05 #1
2 1809
You can inject the link tag into the page that hosts the user control. You
could place a Literal control on the page, then set its .Text property to a
string containing the the link tag. You could do this at the same place in
your code where you insert the control.

-HTH
"Nathan Sokalski" <nj********@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
I have a user control that uses classes from a CSS Stylesheet. Because a
User Control does not have a <head> section, I do not know where to put a
link tag to link it to the stylesheet. If I manually place a a link tag in
the page that I use the User Control in it works fine, but is there a way
to have the control add this link tag for me when I insert the control?
Thanks.
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

Nov 19 '05 #2
EJD
Hi,

The user control that I have in one of my projects looks like this in
the HTML:

<%@ Control Language="c#" AutoEventWireup="false"
Codebehind="Header.ascx.cs" Inherits="MyProject.Header1"
TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
<LINK href="MyProject.css" type="text/css" rel="stylesheet">

Although I do use the same css file for all of the pages in the
project, if I just add the UC to a blank page without adding it to the
webform as well, it seems to work fine... HTH.
EJD

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Eric Anderson | last post by:
I am trying to use XSLT to extend XHTML so that I can have custom widgets. For example I have a calendar control. Whenever I put the following in the psudo-XHTML doc: <calendarbox name="mycal"/>...
1
by: Amir Eshterayeh | last post by:
Dear Friends I need to change the css file of my aspx files dynamically so users can choose their css file names and when page loads, it read css file name from database. I try to use...
7
by: Nathan Sokalski | last post by:
I have user controls that contain a link to a stylesheet. Several of my pages also have a link to this same stylesheet. Because of this, the resulting output contains multiple links to the same...
1
by: Paul | last post by:
Is there a special way to reference a Stylesheet (.css) in a usercontrol? I have a usercontrol in an aspx page.The aspx page itself has a Header Div, within which I put my UserControl.ascx. In the...
15
by: Scott W Gifford | last post by:
Hello, We've got a Web-based application written in Perl that is designed to integrate as a frame into many different Web sites. We currently have several stylesheets available to allow the...
1
by: mikeh3275 | last post by:
I have a header control that I include in my .aspx page. In this control, I'm trying to retrieve a cookie value and store it into a string, but I am receiving an "Object reference not set to an...
8
by: =?Utf-8?B?Q2hyaXMgSGFsY3Jvdw==?= | last post by:
Hi there I've successfully added some .NET validation controls to a page (using <asp:RequiredFieldValidator ...), however when I try to set the 'display' property to 'dynamic', my page then...
2
by: Andy B | last post by:
How do you use css in a user control? I need to put the css in a stylesheet outside of the control.
3
by: Dave Angel | last post by:
I have implemented the 'A list apart' styleswitcher which works great. I now have: - A permanent stylesheet - A normal contrast stylesheet - A high contrast stylesheet The switcher simply...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.