ASP.NET
  Home arrow ASP.NET arrow ASP.NET Custom Server Controls: Breaking t...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP.NET

ASP.NET Custom Server Controls: Breaking the Secrets of Rendering
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 15
    2005-09-06

    Table of Contents:
  • ASP.NET Custom Server Controls: Breaking the Secrets of Rendering
  • Secrets of “Control” class rendering
  • The Secret behind “Render” method of “WebControl” class
  • Secrets of “RenderBeginTag” and “RenderContents”
  • What about the “AddAttributesToRender” method?

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    ASP.NET Custom Server Controls: Breaking the Secrets of Rendering


    (Page 1 of 5 )

    If you are confused about the rendering methodologies of a custom control in ASP.NET, you can simply master it from all of the secrets I introduce in this article.

    In my previous article, I already introduced you to creating your own TextBox control with cool features, without even deriving it from an existing ASP.NET TextBox control.  I concentrated only on getting out my own TextBox, and not much on rendering.  This article should give you insightful information about the rendering methodologies available in ASP.NET custom control development.

    “Control” and “WebControl” class

    To develop any custom control we generally design a class which gets derived from either of the following two classes:

    1. System.Web.UI.Control
    2. System.Web.UI.WebControls.WebControl

    The System.Web.UI.Control provides only the basic functionality to make our custom control participate in the page frame work.  The System.Web.UI.WebControls.WebControl is already derived from the System.Web.UI.Control class and provides support for additional properties such as font, height, width, and so on.  

    The rendering methodology between both classes is quite different from several aspects.  But, one should note that both of them have the “render” method implemented internally (of course we can override them when necessary).  But the lifecycle of a custom control depends upon the derivation from its parent class (either of “Control” or “WebControl” classes).  This is where a control developer can get confused.

    First of all, we need to decide which parent class is necessary for our custom control to be derived from.  We need to make sure that we can even achieve the same output when dealing with any of those two parent classes.  But, here the idea is to find the additional freebies we can get from the “WebControl” class. 

    If our custom control needs to implement all the types of common features like width, height, font, backcolor, forecolor, and so on, it is better to work with “WebControl.”  If we want to take complete control over your custom control (including the normal features of the “WebControl” class), we need to consider the “Control” class.  Once your custom control gets derived from the “Control” class, none of the features of the “WebControl” class will be available to you.  You need to implement all of them by yourself.

    These two classes are quite different from each other when rendering their lifecycles. Let us now go the secrets of rendering from both “Control” and “WebControl” classes.

    More ASP.NET Articles
    More By Jagadish Chaterjee


       · Hello guys, this is my article on "rendering" related to ASP.NET custom control. You...
       · It is really great article, i like it very much, in very easy manner u have made me...
       · I tried to understand this process threw reflecting the .NET code but found my self...
     

    ASP.NET ARTICLES

    - Disadvantages of the ASP.NET MVC Framework
    - Advantages of the ASP.NET MVC Approach
    - ASP.NET Web Forms Weaknesses
    - ASP.NET Web Forms Meets ASP.NET MVC
    - Source Code for Saving and Retrieving Data w...
    - Using GridView to Save and Retrieve Data wit...
    - Handling Dynamic Images in ASP.NET 3.5 AJAX ...
    - Retrieving Data with AJAX and the GridView C...
    - Playing with Images in ASP.NET 3.5 AJAX Appl...
    - Saving and Retrieving Data with AJAX
    - Enhancing PHP Via the ASP.NET AJAX Framework...
    - Enhancing PHP Programming with the ASP.NET A...
    - Classes and ASP.NET AJAX
    - Using ASP.NET AJAX
    - Building a Simple Storefront with LINQ

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
    Stay green...Green IT