Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 2nd, 2008, 10:37 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

VeganMan,

From your questions it sounds a bit like you are asking "How can I use CSS to customize a single instance of a control that use standard styles?"

Let's say you have a style that is normally applied to all your text boxes:

   <asp:TextBox ID="TextBox2" runat="server" CssClass="myTextBox"></asp:TextBox>

But you want to modify this one a bit. Maybe you want a green border instead of the standard one. So you create a style for the green border. You can supplement the standard style by adding another style class to the control:

   <asp:TextBox ID="TextBox2" runat="server" CssClass="myTextBox greenBorder"></asp:TextBox>

As long as the classes are assigned to the control in the correct order and the style rules are in the correct order to cascade properly, you can chain the css classes on a single control. (It might even be the case that the style application will be dictated by the classes on the control rather than the normal cascade rules.)

-Peter
peterlanoie.blog
 
Old April 2nd, 2008, 04:18 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi VeganMan,

Stay tuned.... Later chapters will explain and demonstrate this in more detail, and also explain *why* it happens....

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old April 2nd, 2008, 06:37 PM
Authorized User
 
Join Date: Jan 2007
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by planoie
 VeganMan,

From your questions it sounds a bit like you are asking "How can I use CSS to customize a single instance of a control that use standard styles?"

Let's say you have a style that is normally applied to all your text boxes:

<asp:TextBox ID="TextBox2" runat="server" CssClass="myTextBox"></asp:TextBox>

But you want to modify this one a bit. Maybe you want a green border instead of the standard one. So you create a style for the green border. You can supplement the standard style by adding another style class to the control:

<asp:TextBox ID="TextBox2" runat="server" CssClass="myTextBox greenBorder"></asp:TextBox>

As long as the classes are assigned to the control in the correct order and the style rules are in the correct order to cascade properly, you can chain the css classes on a single control. (It might even be the case that the style application will be dictated by the classes on the control rather than the normal cascade rules.)

-Peter
peterlanoie.blog
Well I've been using CSS for a couple of years now. I try to use css for everything that's possible, having my html down to the bare bones. I'm thinking in terms of accessibility, making the site more assessable for people with different types of disabilities. Using CSS makes it very easy.

I'm new to the asp.net framework though. So I tend to get ahead of myself and think outside the box. Before I got the book, I was playing around and putting my asp:??? tags in a <div #id="???"> <asp:???... <div> tag to control them rather than using CssClass. That was my next question. hehehe... can that be done.

Thank you planoie

Terry

 
Old April 2nd, 2008, 06:44 PM
Authorized User
 
Join Date: Jan 2007
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by Imar
 Hi VeganMan,

Stay tuned.... Later chapters will explain and demonstrate this in more detail, and also explain *why* it happens....
You caught on to me Imar. Yes, the why's are important to me. I'm sort of a visual person so I often like to experiment so I can SEE why and not just KNOW why... I will ban myself from posting if I get too far from the topics. hahaha (book is kind of fun)

 
Old April 2nd, 2008, 07:43 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

You certainly can wrap your asp controls inside of other HTML elements. Just be aware of how much more HTML you add when you may not need to. Also, use the browser view source function liberally so you can see what controls render to what HTML.

-Peter
peterlanoie.blog
 
Old April 2nd, 2008, 07:53 PM
Authorized User
 
Join Date: Jan 2007
Posts: 69
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for the advice Peter

 
Old April 3rd, 2008, 12:28 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

In addition to all this, remember you can also use ID selectors for HTML that doesn't run on the server. E.g.:

<div id="MainMenu">

</div>

can always be referred to as #MainMenu. Since the <div> tag doesn't have a runat="server" attribute, it will never be changed.

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Going back ... possible? asearle XSLT 2 January 8th, 2007 06:24 AM
I'm back mehdi62b C# 10 August 14th, 2006 04:53 PM
Back Up tsimsha Classic ASP Databases 0 September 19th, 2004 08:42 PM
history.back or hitting the back button won't work lian_a Classic ASP Basics 4 July 29th, 2004 12:14 AM
Back Up shamsad Oracle 0 February 11th, 2004 06:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.