Chapter 33: ASP.NET Development


Overview

It has often been the case with Web development that the tools available, however powerful, don’t quite match up with your requirements for a specific project. Perhaps a given control doesn’t quite work as you’d like it to, or perhaps one section of code, intended for reuse on several pages, is too complex in the hands of multiple developers. In cases such as these, there is a strong argument for building your own controls. Such controls can, at their simplest, wrap multiple existing controls together, perhaps with additional properties specifying layout. They can also be completely unlike any existing control. Using a control you have built yourself can be as simple as using any other control in ASP.NET (if you have written them well), which can certainly ease Web site coding.

In the first part of this chapter, you examine the options available to control developers, and assemble some simple user controls of your own. You also look at the basics of more advanced control construction, although you won’t see these in any great depth; whole books are devoted to the subject.

Next, you look at master pages, a technique new to ASP.NET 2.0 that enables you to provide templates for your Web sites. Using master pages you can implement complex layouts on Web pages throughout a Web site with a great deal of code reuse. You also see how you can use the navigation Web server controls in combination with a master page to provide consistent navigation across a Web site.

Site navigation can be made user-specific, such that only certain users (those that are registered with the site, or site administrators, say) can access certain sections. You also look at site security and how to log in to Web sites in this chapter - something that is made extremely easy via the login Web server controls.

After that, you look at some more advanced styling techniques, namely providing and choosing themes for Web sites, which separate the presentation of your Web pages from their functionality. You can supply alternative CSS style sheets for your sites as well as different skins for Web server controls.

Finally, you’ll see how to use Web Parts to enable your users to dynamically personalize Web pages by positioning and customizing controls on a page.

Throughout this chapter you refer to one large example application that includes all the techniques you’ve seen in this and the last chapter. This application, PCSDemoSite, is available in the downloadable code for this chapter. It’s a little too large to include all the code here, but you don’t need to have it running in front of you to learn about the techniques it illustrates. The relevant sections of code are examined as and when necessary, and the additional code (mostly dummy content or simple code you’ve already seen) is left for you to examine at your convenience.




Professional C# 2005 with .NET 3.0
Professional C# 2005 with .NET 3.0
ISBN: 470124725
EAN: N/A
Year: 2007
Pages: 427

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net