guyS's WebLog

IShare, My DotNet Fingerprint

Web Control VS Designer Support - to do or not to do?

Everyone agree that Custom composite web controls is fantastic way toward re-use, extend and all the bonuses we get from OO

I want to share with you a difficulty we always encounter in the IT department I'm part of.

Our IT project managers new slogan is try to do "more with less". This is because of budget considerations & Time to market constraints.

Usually this leads to the following results - when we need to set a design to a module that can be re-use in different pages of our application it will be done using User Control. User Control are easy & intuitive way to code re-usable visual component that will use in different places within the web applications (again do more with less is guiding principle).

When we need a control that we know it could be re-use in different applications (multiple file upload control for example) we design it as a custom web control or composite web control.

[The different is the custom web control is existing web control we extend to gain new functionality (inherits from TextBox, Label or other existing web control). Composite web control is few web controls that together with attached methods and events gives us the required functionality]

The problem is (and this is what I am aiming for) we get the resources (developers, time, budget) to the develop the must functionality which is the Web Control itself but we cannot convince our project manager why we need to implement the Designer support for our web control.

The project requirements being divided into high priority feature list and "nice to have" features. The support of the VS Designer to a re-usable custom web control categories as "nice to have" feature. When we said the designer support will enlarge developer users productivity but we will need more time in order to supply it their answer is write a short, clear developer guide instead.

This is why all of our custom/composite controls in our IT department do not have designer support

When a developer drag one of our custom control to the designer form he will get in the control display something like

"Error creating control" or "There was an error rendering the control"

Now - the thing is that (and I want to be honest with you ) even when we got the OK from our project manager to add VS designer support then we don't have the motivation to do it.

We are not component providers specialists that have to supply enhance controls with designer support to make the control more productive.

We also prefer to get into other .NET Namespaces that will be more valuable to us and to our department instead of drill down the VS designer namespace which is not often used by different software companies that are not component providers.

I guess you encounter this problem too.

Now, what I suggest is the following -

Microsoft or one of the leading component provider will supply a simple VS integrated wizard that will build and attach the VS designer class support for our custom/composite class (I guess that with reflection this is possible)

The wizard engine will find our public properties & events and build for it the required VS support

I think this kind of Wizard can be really essential & complementary tool for lots of developers

Don't u think?

Comments

Memi Lavi said:

I think you should define more clearly which designer support are you looking for. Roughly speaking, the designer support in .NET is divided into three categories:
1. Attributes
2. Type Converters
3. Type Editors

The attributes implementation is quite simple, and its implementation involves adding one or two lines of code to each property / method. I wouldn't go to a project manager for this, and IMHO no web control should be created without it.

The type converters and type editors are much more complicated, and should be considered carefully.
However, I didn't understand what wizard are you looking for. The vs.net designer already take care of your public members in the property grid. If you have an error displaying the control in the designer - it's a specific error, and not part of the designer support.
# April 17, 2004 3:56 PM

Guy Sofer said:

I meant the ones which responsible to display the custom control in the designer forms visually - which sometimes can be rich display. I guess these are the type converters and type editors responsibility.

I had in my team a very talent programmer that spend 8 intensive days to understand and implement a visual display of its custom web control (include databinding support).
Because this is not defined as a must functionality - we tend to avoid it.

The wizard I suggested should map the controls that compose the custom web control and display in in the VS designer form. In case the control use data binding, inner class properties, templates then the designer should support it too. Using the properties window is quite straightforward. Why the visual display does not?
# April 17, 2004 4:23 PM

Guy Sofer said:

To be more specific when using the word display - I mean not only to be able to see my control in the designer form but also in the HTML editor. In the HTML editor I would like that my control will get by using the wizard the VS intelisense full support, inner classes elements and attributes, templates and data binding
# April 17, 2004 5:06 PM

AndrewSeven said:

The designer support is pretty good.

It can be hard to get a handle on at first, but when you have made a couple it becomes very easy to add simple and usefull designers.

Eg: Designer verbs have limits, but how much easier could it be to add them.

# April 17, 2004 6:16 PM

Joe Brinkman said:

There is a minimal set of designer support that should be added for any control. You can usually handle it with less than 10 or so lines of code. At a minimum you can add a designer that returns simple designtime html. One attribute < Designer(GetType(MyCustomDesigner))> and one method in the MyCustomDesigner class
...
Public Overrides Function GetDesignTimeHtml() As String
Return "<div>Show the user something</div>
End Function
...

will at least give the control user something more than the 'invisible' box with the little green arrow. The bible on this topic is "Developing Microsoft ASP.Net Server Controls and Components" by Nikhil Kothari and Vandana Datya. You will not in my opinion find a better reference on the topic.
# April 22, 2004 8:59 PM

TrackBack said:

# May 9, 2004 2:33 PM

TrackBack said:

# May 10, 2004 1:47 AM

Rafael said:

Yes. It's good! Thank you for this article

# June 20, 2008 8:13 AM
Leave a Comment

(required) 

(required) 

(optional)

(required)