Developing custom Web ADF controls


About developing custom Web ADF controls

Building custom Web controls that include or implement Web Application Developer Framework (ADF) components enable you to encapsulate and utilize the rich feature functionality included with the Web ADF. The following guidelines help you create components that optimally leverage the server and client capabilities of the Web ADF and ASP.NET Asynchronous JavaScript and XML (AJAX) specifications. 
  • Post 9.3, the development methodology for Web control developers is to implement scriptable controls that take advantage of client side behaviors and make requests to the server only when necessary. 
  • Inherit controls from the base Web ADF WebControl or CompositeControl so that components on the page can leverage the power of the Web ADF JavaScript and ASP.NET AJAX libraries. 
  • Maximize the use of the Web ADF JavaScript and ASP.NET AJAX libraries to provide rich and responsive user experiences. 
  • Never store Web controls in session state. Web controls hold a reference to the Page object, which references all the other controls. Storing controls in session causes unnecessary storage of a large object graph. For more information, see ASP.NET Memory on the Microsoft Developer Network Web site (MSDN).
  • Take advantage of client side processing with Dynamic Hypertext Markup Language (DHTML) and JavaScript. This is particularly important in light of the future Web development roadmap of Rich Internet applications (RIAs), JavaScript, Silverlight, and so on. 
  • Minimize reliance on the server for user interface (UI) updates. For example, to make updates to enable and disable UI elements based on selecting a check box, there is no need to make a callback to the server. This and similar behaviors can be achieved using JavaScript and DHTML, which is more efficient than making a round-trip to the server. 
  • Carefully consider the following architectural and design questions:
    • Should the server be tracking all of the UI state or just the UI state changes that act on data?
    • What is the role of the server side presentation layer when Web browsers can speak Representational State Transfer (REST)?
    • If the client owns the state, how should the server rehydrate the state?
  • For data transmission and short term (that is, in-memory) storage, use well known and standard data formats, such as JavaScript Object Notation (JSON) rather than custom formats. This yields code that is more maintainable, reusable, and extensible.   
  • Cache state on the client using JSON objects and scriptable components and controls.
  • Leverage the AJAX libraries for registering client scripts (for example, by using a ClientScriptResource attribute) to avoid boiler plate code.
  • Use the base.IsAysnc property instead of Page.IsCallback and Page.IsPostback.
  • Use Object Oriented Programming (OOP) patterns from ASP.NET AJAX, and take advantage of the namespace functionality to avoid polluting the global namespace. For more information, see Using ASP.NET AJAX on the ASP.NET Web site.


See Also:

ASP.NET Memory
Using ASP.NET AJAX