Style sheets

Discussion in 'ASP .Net' started by Robert Bull, May 11, 2004.

  1. Robert Bull

    Robert Bull Guest

    I am creating a menu with the ComponentOne tools that come with the
    ..Net resource kit. I am trying to apply a style sheet to the controls
    of the menu but I dont know how. Do I need to add a new style sheet or
    can I use the styles.css? If I add a new style sheet, how do I apply
    it to the menu controls? There is a property in the properties window
    called CssClass but I dont know what to put there. I have never used
    style sheets for anything in .net so I am pretty lost. Thanks in
    advance.

    -Rob
     
    Robert Bull, May 11, 2004
    #1
    1. Advertising

  2. The CSSClass property takes a string value. Assume that a Web form has a text box control called "TextBox1", you would set the CSSClass property with this statement: TextBox1.CSSClass="TBStyle". "TBStyle", in this instance, would need to be defined in your style sheet. If you're going to use Styles.css (the default style sheet in a Visual Stuio.NET project) you need to include this directive in the <HEAD> tag in your .aspx page: <LINK href="Styles.css" type="text/css" rel="stylesheet"

    From what I've seen, VS.NET does not seem to automate the insertion of the stylesheet directive into an .aspx page in any way. This seems rather curious, since there are so many other nice code-generation features in VS

    By the way, once you've established a style sheet, you can instantiate style objects in your code, something like this

    Dim MyStyle as New Styl
    MyStyle.CssClass="TBStyle

    Then, the style objects are usable with the ApplyStyle and MergeStyle methods of individual control objects. Personally, I've found this to be quite useful for getting things to really look the way I want them to
     
    =?Utf-8?B?UmljaA==?=, May 11, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kevin Spencer

    Re: Using external style sheets

    Kevin Spencer, Jul 9, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    376
    Kevin Spencer
    Jul 9, 2003
  2. PJ

    CSS Style Sheets

    PJ, Aug 21, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    400
    Vincent V
    Aug 22, 2003
  3. Replies:
    1
    Views:
    815
    Bertilo Wennergren
    Nov 24, 2003
  4. Carl Corcoran
    Replies:
    1
    Views:
    294
    Bob Barrows
    Nov 12, 2003
  5. Jake Barnes
    Replies:
    6
    Views:
    218
    Lawrence Krubner
    Apr 12, 2009
Loading...

Share This Page