By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,686 Members | 1,510 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,686 IT Pros & Developers. It's quick & easy.

Style sheets

P: n/a
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

Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
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

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

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.