ASP.NET Custom Server Controls: Cute ToolTip Control with Better Framework - What is the ToolTip Designer class?
(Page 6 of 6 )
That is a special type of class, which gets executed when the control is about to be rendered only at design time. Here it makes sense to use it, as there is no involvement of design-time properties to be set. It is defined something like this:
Public Class ToolTipDesigner
Inherits System.Web.UI.Design.ControlDesigner
Public Overrides Function GetDesignTimeHtml() As String
Return "You will be able to see the tooltips only at
runtime"
End Function
End Class
The method “GetDesignTimeHtml” gets executed when our tooltip control is dragged from the toolbox onto the web page at design time. As the control does nothing here and it does not have any properties, we simply return a message.
This class (“ToolTipDesigner”) gets linked to our control with the “<Designer>” attribute at class level. The class declaration of our ToolTip control would be something like this:
<Designer(GetType(ToolTipDesigner)), DefaultProperty("Text"),
ToolboxData("<{0}:ToolTip runat=server></{0}:ToolTip>")> Public
Class ToolTip
Inherits System.Web.UI.WebControls.WebControl
That finishes the matter. Please undestand that all of the ASP.NET controls (in this series) have been tested only with Internet Explorer 6.0. I request that you make necessary modifications to suit your needs of cross browser compatibility. I leave it to the developers for further enhancing the same control. The areas of improving the same control would include better eventing, better JavaScript, data-binding support, cross browser support, and so on. Good luck.
Any comments, suggestions, bugs, errors, feedback etc. are highly appreciated at jag_chat@yahoo.com.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |