ASP.NET
  Home arrow ASP.NET arrow ASP.NET Custom Server Controls: Cute ASP.N...
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: Cute ASP.NET TextBox with Help Tips
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 13
    2005-10-03

    Table of Contents:
  • ASP.NET Custom Server Controls: Cute ASP.NET TextBox with Help Tips
  • Understanding the life cycle – Rendering methods
  • Understanding the life cycle – Attributes
  • Emitting necessary properties
  • Briefly understanding the JavaScript implementation

  • 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: Cute ASP.NET TextBox with Help Tips


    (Page 1 of 5 )

    In my previous articles (of this series), I introduced you to how to create your own TextBox control with cool features without even deriving it from existing ASP.NET TextBox controls (including client-side JavaScript emission). In this article we will further enhance the same control with “help tips” to be displayed in a separate label (either on focus events or on mouse events).
    A downloadable file for this article is available here.

    The sample downloadable solution (zip) is entirely developed using Visual Studio.NET 2003 Enterprise Architect on Windows Server 2003 Standard Edition.  But, I am confident that it would work with other versions of Windows (which support .NET 1.1) as well.

    Introduction

    My previous articles have already shown you how to create any custom control from scratch.  Now, I will not be going into the details of creating a solution, project, etc.  I will just take this opportunity to explain the features available and how they have been implemented in the above downloadable VS.NET solution.

    When we developed an ASP.NET product in our organization, one of our customers asked us to enhance the product with “help” wherever possible.  As you know, if it is a web application, just tool tips should do the job.  But they rejected our proposal.  We asked them if they needed a popup. Again, the answer was NO.

    They asked us to provide some type of “help tips” (always at some corner) for each and every field (during data entry) they would input.  Finally, we understood that when any “server control” receives a focus (or on mouse events), some “help tips” have to be displayed in some “panel” (so that we can place the panel at any corner).

    As you know, this is not really ASP.NET. We needed to add extra JavasScript “tidbits” for each and every control.  As we had already completed that project, there exists no other way to accomplish this, apart from adding JavaScript for every control throughout the application.  But, what if we needed to provide the same thing for a new project?  The solution would be to develop our own server controls by extending the existing ones, and adding some JavaScript at the control rendering level to emit it at client-side (along with design-time support). 

    In this article, we develop a simple textbox with help tip support, right from scratch (even without extending from an existing textbox control in ASP.NET).  I used four new methods of rendering.  They are as follows:

    • RenderBeginTag
    • RenderContents
    • RenderEndTag
    • AddAttributesToRender

    To be frank, all of the above methods are not really necessary for the TextBox control I developed.  But, this gives me an opportunity to explain all four simultaneously.  We can also implement all of our controls in a single “render” method as well.  But, the above methods give much more flexibility by separating various divisions of rendering.

    More ASP.NET Articles
    More By Jagadish Chaterjee


       · Hello guys, Cute control...further enhanced..., any suggestions to enhance it?
       · good article, the code is kinda hard to read though
       · thanks for the comment. You can download the sample to go through the code in a...
     

    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 1 hosted by Hostway
    Stay green...Green IT