Re: Usercontrol, add styles via Page.Header.Attributes ?



First, i'm not sure i posted this in the correct group, there is a
webcontrols group as well, my current problem applies to a custom control
for asp.net (therefore the styles of course :) )

--------

The idea is that i would like to prepare self-contained controls and
therefore i don't prefer seperate css files.
I was wrong yesterday by mentioning using the server tag for each control to
add styles dynamically to each control.
I just put a styles section directly into my usercontrol html part, it works
but it's not recommended.
Styles should be in the head and preferrable as include.
Well i know that there are webresources but my knowledge about this all is
not that far yet + the usercontrol is not a compiled control since it still
depends to much on the project.
(Like database tables and fields etc + there is no need)
Therefore i choose for styles in the html, the easy way..

I'm just figuring out how to deal with things, it's not all that trivial.

And then there is the problem of recurring insertions, meaning multiple
instances of my usercontrol on the same page would then insert duplicate
styles (and javascript code) with the same name(s).

For js there is this asp.net solution to register functionality which
results into one codeblock on multiple inserts.
Maybe this is also available with styles??

There are several solutions, i'm working slowly to a better approach with
respect to the complete control, not only this styles issue.
Most of my usercontrols are never required outside the project, it would
cost to much time to make them stand-alone anyway.



"John Saunders" <john.saunders at trizetto.com> schreef in bericht
news:uU6jB4fGHHA.4688@xxxxxxxxxxxxxxxxxxxxxxx
"Edwin Knoppert" <news@xxxxxxxxxxxxxx> wrote in message
news:4576c3e3$0$2026$ba620dc5@xxxxxxxxxxxxxxxxxxxxxx
I need specific styles for controls inside a gridview template.
Since these are ASP.NET controls they expect a classname, not one or more
styles.
(Which can be set via code as well)

I have > 8 styles to set, so alternatives are pretty cumbersome imo.
(We keep the server working this way, instead of the client's browser
only)

I don't understand your problem. We also use CSS classes very heavily. We
have our controls reference the classes via CssClass on a server control
or "class" on a client tag. We then have the pages reference the .css
files containing the definitions of the classes. We have a base page class
which emits the correct <link> tags on every page. This works well,
without a control attempting to set styles for the page (which is a lot
like the tail wagging the dog).

John




.



Relevant Pages

  • Re: How to add a small HTML table under a row of a GridView
    ... No forget resources, just create a control. ... I just tested, works fine, here is a label + usercontrol. ... The register tag needs to be present in the aspx where the grid is. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Instantiate/Load UserControl from DLL
    ... Would you mind giving out the code for FindControlQ? ... UserControl control = packageManager.GetControl; ... does not execute/interpret the actual ascx file that has the HTML ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Instantiate/Load UserControl from DLL
    ... Code Snippet Begin ...] ... UserControl control = packageManager.GetControl; ... does not execute/interpret the actual ascx file that has the HTML ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Dynamically Loading a UserControl
    ... only one user control is being rendered. ... SelectedIndexChanged event do a Server.Transfer and apend a QueryString to ... Requestquery string to know which control to load. ... > keeping track of what UserControl to load upon a page being posted back. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: "The system cannot find the file specified" appears peridically in runtime
    ... As for your questions - pix:DispOfficeMajor is indeed the usercontrol. ... before - the control is perfectly compiled. ... "public" part, root folder of the website - in which that control resides, ... As for your second suggestion - Reference problem. ...
    (microsoft.public.dotnet.framework.aspnet)

Loading