|
-
Jul 12th, 2004, 07:37 AM
#1
Thread Starter
Hyperactive Member
Using Styles.css
Hi all,
I just wanted to double check something.
When you create a new webapplication in VB.Net, it does not automatically use the styles.css, correct?
I added a reference to it using standard html in the <HEAD> section of my page and it worked fine.
Is there a property that can assign a stylesheet without having to enter the html manually?
Thanks,
JB
JazzBass
In the .NET era
Trying to remember VB6
Progress: 
XP Professional @ Home
and @ the Office
-
Jul 13th, 2004, 03:43 AM
#2
It's just one line of HTML. How difficult could it be to copy and paste it?
I don't think there is any such property. (Nor should there be one)
-
Jul 13th, 2004, 04:57 AM
#3
Thread Starter
Hyperactive Member
Yeah, I know it's only one line of html.
I can understand if you are wanting to link a stylesheet you created from elsewhere, but they create one for you with the project, then not link it for you?
Why create it for you if you are not going to use it by default.
I spent 10 minutes making changes to the stylesheet and when I didn't see any differences, I figured it wasn't linked and thus had to add it.
It seems silly to me.
JB
JazzBass
In the .NET era
Trying to remember VB6
Progress: 
XP Professional @ Home
and @ the Office
-
Jul 13th, 2004, 07:32 AM
#4
Well, the closest thing would be that you can drag and drop that CSS file from your solution explorer, and it'll write that line for you.
-
Jul 13th, 2004, 07:33 AM
#5
And I don't think it's silly. It only promotes laziness, as if we aren't halfway there already!
-
Jul 13th, 2004, 07:46 AM
#6
Thread Starter
Hyperactive Member
Thanks.
Yeah, I guess we have much higher expectations than we did a few years ago.
I appreciate the suggestion.
Take care,
JB
JazzBass
In the .NET era
Trying to remember VB6
Progress: 
XP Professional @ Home
and @ the Office
-
Jul 13th, 2004, 08:42 AM
#7
PowerPoster
Originally posted by mendhak
And I don't think it's silly. It only promotes laziness, as if we aren't halfway there already!
I don't think I should be copying and pasting a line of code for each page.
Doesn't that seem as silly as writing out the control creation code instead of just dropping the textbox on the form visually. Each control has a CSSClass property, why shouldn't the form have a CSSFile property?
It isn't about laziness, it is about making my experience better. C# doesn't even include a default style sheet, so consider that sheet being made for you in VB a luxury...lol.
-
Jul 13th, 2004, 11:25 AM
#8
What if you want to have several CSS files for the same page?
Eventually, specifying the CSS files evaluates to the same thing. I think it'd be way too much of a "luxury" to provide a means of including the style sheet automatically than actually putting the light in.
-
Jul 13th, 2004, 06:02 PM
#9
You can do this if you set your HEAD tag with runat=server attribute and giving the tag an ID. Then in your code-behind page you can declare a variable with the same ID. Here is the example. My ID of the HEAD tag would be head.
Code:
<HEAD id="head" runat=server>
...here goes the rest of the HTML code
In my code-behind I would declare it like:
Code:
protected HtmlGenericControl head;
Now in the Page_Load event:
Code:
private void Page_Load(object sender, System.EventArgs e)
{
head.InnerHtml += "<LINK rel='stylesheet' type='text/css' href='Main.css'>";
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|