Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Getting Started with ASP.NET : Page 8

Learn what it takes to begin building ASP.NET Web sites with Visual Studio .NET. This article will provide you with the knowledge you need to jumpstart your foray into the world of ASP.NET development.


advertisement
User Controls
User controls, a wonderful feature in ASP.NET, let you bundle multiple UI elements into a single control and place it on a Web Form. If you are familiar with server-side include files, you already have an idea of what I'm talking about. Typical uses of a user control might include a page header or page footer used on multiple pages.

Interesting Fact #7: For more information about User Controls see ASP.NET: Extending the Power of Web Pages with User Controls in the Sep/Oct 2002 issue of CoDe Magazine.
Working with Style Sheets
You can use style sheets to apply formatting characteristics to your Web page content. Style sheets let you make site-wide formatting changes quickly and easily. The concept is simple; you create a file named styles.css, for example, which contains HTML formatting tags and specifies how you want to display your Web page content. For example, suppose you want to make all H3 commands Arial font. Or, suppose you want to make all paragraph commands indent a half-inch. You can even specify the distance you want between lines. You get the idea.

Interesting Fact #8: For additional information on the Visual Studio .NET IDE, check out
20 Cool Visual Studio .NET IDE Features by Markus Egger in the CoDe Magazine March/April 2002 issue.

When you create a new ASP Web Project, ASP.NET automatically creates a Styles.css to use in the project. You can use this style sheet, copy an existing Styles.css file over the one automatically created, or you can use a style sheet of a different name altogether. If you decide to go with a style sheet with a name other than Styles.css, you need to add it to the project by right-clicking the project, selecting Add, and then selecting Add Existing Item.

This example shows a new characteristic named mainheading that I added to the styles.css stylesheet:

.mainheading { font-family: Verdana, Helvetica, sans-serif; font-size: 14pt; font-weight: bold }

In order for a page to adhere to the formatting options in a style sheet, you need to reference the style sheet in the page containing the controls that you want to format. You can do this by dragging and dropping the style sheet from the project onto the page, or by adding the following LINK code to the <HEAD> section of the HTML page:

<LINK href="Styles.css" type="text/css" rel="stylesheet">

Once you've linked your style sheet to the page you can begin applying the formatting styles to controls on the page by setting the CssClass property (see Figure 22).



Jim Duffy is founder and president of TakeNote Technologies, an award-winning training and software development company. He has a BS degree in Computer and Information Systems and over 18 years of programming and training experience. He is an energetic trainer, skilled developer, and has been published in leading developer-oriented publications. Jim, a recent Microsoft MVP award recipient, is a popular speaker at regional user groups and developer conferences. Additional information about Jim and TakeNote Technologies can be found at www.takenote.com. jduffy@takenote.com
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Thanks for your registration, follow us on our social networks to keep up-to-date