expert.net development a guide to developing web server controls by jonas stawski...
TRANSCRIPT
Expert .NET Development
A Guide To Developing Web Server Controls
By Jonas [email protected]
http://aspsoft.blogs.com/jonas/
What are web server controls
• A class– Derives from WebControl
• Are used to represent html as objects– Label = <span>– Table = <table>– TableCell = <td>– Textbox = <input type=“text”
• Two Categories:– Rendered (Label, Textbox, etc)– Composite (Treeview, Calendar, etc)
Why use them?
• RAD (Rapid Application Development)
• Enterprise Graphical Components
• Standard within .NET
• Facilitate the work for others
Difference between user control and web server control
Web Server Control User Control
Enterprise Local to an application
No UI Ascx file with Graphical Interface
Exposes design and run time properties
Exposes run time properties
Useful for composite control and single control
Better used for multiple controls
How to create a web server control?
• Create a new project from class• Inherit control from WebControl or any other
control (for extending it)• implement INamingContainer (for composite
controls)• Override functions:
– CreateChildControls (for composite controls)– Render
• Compile• Add to toolbox