ASP.NET Custom Server Controls: Cute ASP.NET TextBox with Help Tips - Emitting necessary properties
(Page 4 of 5 )
Since we now understand some of the rendering methods of this control, let us go through some of the properties which may be necessary at design time. I exposed five properties to facilitate customization. They are as follows:
- Text
- HelpTipDispControl
- HelpTipText
- ShowHelpTipsOnFocus
- ShowHelpTipsOnMouse
All of the above properties are supported with “viewstate”. If you are new to “viewstate”, I suggest you to go through my previous set of articles (in the same series). Now, let us look at each of them.
I hope everyone could easily imagine the “Text” property, the classic property for displaying some text in the textbox. We have one more property resembling this, called “HelpTipText”. The developer can use this property to assign some text which needs to be displayed as “help” (at some corner within the web page).
Once we assign the “help tip” text, where do we want it to display? This is where the property “HelpTipDispControl” comes in. The developer can use this property to assign a container control name (in general it should be the name of a panel created on a web page to hold our help tips) that displays text specified in “HelpTipText”. You can fix the control (panel) at any location on the web page. If this property is omitted, the help tips would never be displayed.
Proceeding further, we have two more properties, “ShowHelpTipsOnFocus” and “ShowHelpTipsOnMouse”. I can control the display of help tips using both of these properties. When “ShowHelpTipsOnFocus” is set to true (at design time), we get help tips displayed, when the textbox receives focus (and of course, it vanishes when the focus gets lost). When “ShowHelpTipsOnMouse” is set to true, we get help tips displayed, when we hover the mouse on textbox (and of course, it vanishes when the mouse is out of the control).
To understand all of the above properties practically, I suggest you download the solution and play with properties.
Next: Briefly understanding the JavaScript implementation >>
More ASP.NET Articles
More By Jagadish Chaterjee