|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Using a Stylesheet in a User ControlI 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. 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 Show quoteHide quote "Nathan Sokalski" <njsokal***@hotmail.com> wrote in message news:%23H8QiHmXFHA.2664@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 > njsokal***@hotmail.com > http://www.nathansokalski.com/ > 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
How to react to an ImageButon in a DataList ?
AutoPostBack How can I use my Own control in DataGrid? The nowrap Property of TD Tags Text control - password Referencing Datagrid Rows while Datagrid is Sorted TextBox.Text not getting the proper value Datalist Dynamic Template Loading Problem TableCell Text Wrapping Problem! Positioning Panel on WebForm at runtime |
|||||||||||||||||||||||