eBusiness Help
Free Whitepaper: Ten Secrets for Successful Customer Service
Reduce the cost of customer service - When customers help themselves at a web site.
Download the world's leading XML Integrated Development Environment now!
Stylus Studio 6 XML Enterprise Edition, Release 3 is an advanced XML Integrated Development Environment (XML IDE).
Free Trial: Easily Create Online Help. And Online Anything Else.
Quickly design and deliver professional online content from your Word documents.

Free Software Archive:
Enterprise and Home Networking Downloads

Recent Articles

Microsoft’s Doom: Open Source
Microsoft may be in trouble. Right now, Windows dominates the PC market and it has for a while but Linux has developed its following that following may grow if the British government has its way.

Cisco Snatches Sheer Networks for $97 Million
Networking mammoth Cisco Systems announced the purchase of Sheer Networks based in San Jose, California. The $97 million deal will add Sheer's intelligent network and service management products to Cisco's already vast services.

Remote and Local ASP Debugging Tool
Debugging ASP (Active Server Pages) can be a real challenge these days. With virtually no software tools on the market most web developers have to struggle with manually finding ASP errors as they appear...

09.14.05


Using A Custom Base Class For Your ASP.NET Page's Code-Behind Classes

By Scott Mitchell

One of the many benefits of object-oriented programming is that it allows for reuse of logic. For example, classes can be created that contain a base level of functionality.

These base classes can then be extended through inheritance to create new classes that encompass the functionality of the base class along with any custom logic needed. The end result is that as a developer, once the base class has been created, you can extend and enhance the functionality of the base class with minimal effort. (For a more in-depth look at inheritance be sure to read Ian Stalling's article, Using Object-Orientation in ASP.NET: Inheritance.)

Since the .NET Framework is built upon the principles of object-oriented programming (OOP), it's no surprise that ASP.NET borrows heavily from the tenets of OOP, one such tenet being inheritance. The base functionality for all ASP.NET pages is spelled out by the Page class in the System.Web.UI namespace. This class defines the essential properties, methods, and events for an ASP.NET page, including such members as:

* The intrinsic objects - Response, Request, Session, and so on,

* Common properties - IsPostBack, IsValid, and others,

* Methods used throughout the page lifecycle, such as SavePageViewState(), ProcessRequest(), RaiseChangedEvents(), and others.


While all ASP.NET pages must be derived from the Page class, they need not be directly derived. That is, an ASP.NET page may extend a class that, itself, extends the Page class. In fact, when using the code-behind model for creating ASP.NET pages the actual ASP.NET page is derived from the code-behind class, with the code-behind class being derived from the Page class.

In fact, oftentimes it makes sense to create a base class for a particular ASP.NET Web application that extends the Page class and have all code-behind classes derive from this class, rather than directly from the Page class. This universal base class can contain its own properties, methods, or events that are common to all pages in the particular ASP.NET application, or it can extend the functionality of existing methods or properties. In this article we'll look at how to create and start using a custom base class. Read on to learn more!

Read the rest of the article.

About the Author:
Scott Mitchell, author of five ASP/ASP.NET books and founder of 4GuysFromRolla.com, has been working with Microsoft Web technologies for the past five years. For more inoformation check out Scott's book ASP.NET Data Web Controls Kick Start (ISBN: 0672325012).

About WebProASP
WebProASP is a collection of up to date tutorials and insightful articles designed to help ASP users of any skill level implement successful ASP systems and practices. ASP Strategies and Tactics for Business

WebProASP is brought to you by:

SecurityConfig.com NetworkingFiles.com
NetworkNewz.com WebProASP.com
DatabaseProNews.com SQlProNews.com
ITcertificationNews.com SysAdminNews.com
WebProASP.com WirelessProNews.com
CProgrammingTrends.com ITManagementNews.com



-- WebProAsp is an iEntry, Inc. publication --
iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509
2005 iEntry, Inc.  All Rights Reserved  Privacy Policy  Legal

archives | advertising info | news headlines | free newsletters | comments/feedback | submit article
ASP Strategies and Tactics for Business WebProASP News Archives About Us Feedback WebProASP Home Page About Article Archive News Downloads WebProWorld Forums Jayde iEntry Advertise Contact