ASP.NET Custom Server Controls: WordHack Control - What is the WordHack Designer class?
(Page 5 of 5 )
That is a special type of class which gets executed when the control is about to be rendered only at design time. It is defined something like the following:
Public Class WordHackDesigner
Inherits System.Web.UI.Design.ControlDesigner
Public Overrides Function GetDesignTimeHtml() As String
Return "WordHack works only at runtime"
End Function
End Class
The method “GetDesignTimeHtml” gets executed when our “WordHack” 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 (“WordHackDesigner”) gets linked to our control with the “<Designer>” attribute at class level. The class declaration of our “WordHack” control would be something like the following:
<Designer(GetType(WordHackDesigner)), DefaultProperty("Text"), ToolboxData("<
{0}:WordHack runat=server></{0}:WordHack>")> Public Class WordHack
Inherits System.Web.UI.WebControls.WebControl
That finishes the matter. Please make sure that all of the ASP.NET controls (in this series) have been tested only with Internet explorer 6.0. I request that you make the necessary modifications to suit your needs of cross browser compatibility. I leave it to the developers to further enhance the same control. The areas of improving the same control would include better eventing, better JavaScript, cross browser support, and so forth. 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. |