Step by step guide for developing custom server control with custom collection editor

This guide is step by step instruction to create custom web control. The describe control contains complex property (Collection of classes) that the user can edit using custom type editor. Collection data will be preserving by control as control sub Html tags. This guide also contains most common issues relating to development such a control. The control that we about to develop name is commands and it part of NWAF framework that I'm working on. This control task is to let users to set commands to server control events laid down on web page. Commands has a property holding collection of classes that containing control name, event name and command name set to specify event. The user can add command to control events by using custom editor. Our custom editor show controls on page in hierarchal view. Choosing a control show it server side events and while selecting given event the user can set command name for that event. Controls event commands persist as inner HTML under commands control tags. The HTML output of our control should look like:

<cc1:Commands id="Commands2" style="Z-INDEX: 105; LEFT: 24px; POSITION: absolute; TOP: 107px" runat="server" Height="2px" Width="15px">
    <cc1:InnerCommand EventName="Click" ControlID="Button1" CommandName="a"></cc1:InnerCommand>
    <cc1:InnerCommand EventName="Command" ControlID="Button1" CommandName="b"></cc1:InnerCommand>
    <cc1:InnerCommand EventName="SelectedIndexChanged" ControlID="DropDownList1" CommandName="natty"></cc1:InnerCommand>
    <cc1:InnerCommand EventName="TextChanged" ControlID="TextBox1" CommandName="roni"></cc1:InnerCommand>
</cc1:Commands>

Full article : http://weblogs.asp.net/ngur/articles/144770.aspx

Complete code available for download.

No Comments