ASP.NET
  Home arrow ASP.NET arrow Page 2 - ASP.NET Custom Server Controls: Round Corn...
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: Round Cornered box control in ASP.NET
By: Jagadish Chaterjee
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 5
    2005-09-26

    Table of Contents:
  • ASP.NET Custom Server Controls: Round Cornered box control in ASP.NET
  • Exposing properties for every side (including corners) of the box
  • Creating the header
  • Creating the body (content)
  • Closing the body (content) and creating the footer

  • 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: Round Cornered box control in ASP.NET - Exposing properties for every side (including corners) of the box


    (Page 2 of 5 )

    As you know, every side of the box needs to be provided with some image (including the corners, of course).  The following are the properties which handle all of those images (paths of those images).

          Property ImageTopLeftURL() As String
       Property ImageTopMiddleURL()
    As String
       Property ImageTopRightURL()
    As String
       Property ImageMiddleLeftURL()
    As String
       Property ImageMiddleMiddleURL()
    As String
       Property ImageMiddleRightURL()
    As String
       Property ImageBottomLeftURL()
    As String
       Property ImageBottomMiddleURL()
    As String
       Property ImageBottomRightURL() As String

    I hope all of the above are simple to read and understandable.  I declared each of those properties with an attribute at the top as follows:

    <EditorAttribute(GetType (System.Web.UI.Design.UrlEditor),GetType
    (System.Drawing.Design.UITypeEditor))>

    The above is the most exciting statement used with all the previous properties.  The “EditorAttribute” is mainly helpful for the Visual Studio.NET designer to facilitate an editor for the value being provided to that property (similar to the “Font” property). 

    In this case, we attach a dialog box (Visual Studio.NET supported open dialog) to the property, to facilitate the developer in selecting a respective image from folders within the web application hierarchy. If we don’t specify the above attribute, the developer needs to remember and type the entire path of the image within the property window of Visual Studio.NET designer, as opposed to simply selecting the image file.

    Starting  with <TABLE>

    The default “Render” method (when not overridden by us) usually calls “RenderBeginTag” before calling any other methods.  Let us examine the “RenderBeginTag” method in my control step by step:

    MyBase.AddAttributesToRender (writer)
            writer.AddAttribute (HtmlTextWriterAttribute.Name,
    Me.UniqueID)
            writer.AddAttribute (HtmlTextWriterAttribute.Id,
    Me.ClientID)
            writer.AddAttribute (HtmlTextWriterAttribute.Border,
    "0px")
            writer.AddAttribute (HtmlTextWriterAttribute.Cellpadding,
    "0px")
            writer.AddAttribute (HtmlTextWriterAttribute.Cellspacing,
    "0px")
            writer.AddStyleAttribute ("text-Align", "center")
            writer.AddStyleAttribute ("vertical-Align", "middle")
            writer.RenderBeginTag (HtmlTextWriterTag.Table)

    Within the above method, I am trying to call the “MyBase.AddAttributesToRender(Writer)” statement to add any design-time attributes to my control.  This is a must when we use the control with the Visual Studio.NET designer.  You can also override with any other attributes you want (as shown in my previous articles of the same series).  From all the above statements, the conclusion would be something like: I am trying to render a “<TABLE>” tag with some attributes. Please note that the tags have not yet been closed!

    Starting simply with “<TABLE>” is not enough. We need to frame 3x3 set of cells within the table.  I call the first row of cells the header, second row of cells the body (or content) and third row the footer for better understanding.

    In our next section, we shall see how to implement the header.

    More ASP.NET Articles
    More By Jagadish Chaterjee


       · Hi everyone...just have a look at the new ASP.NET control I presented...any...
     

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