views:

43

answers:

2

I have a UserControl that contains a DropDownList and an ObjectDataSource. That control is used in the markup of my MasterPage.

In the Designer of a ContentPage that uses that MasterPage I can see the DropDownList and the ObjectDataSource. See for yourself.
alt text

I know that other controls (like ComponentArt:Grid) only show themself as outer container and hide the inner controls.

I guess that is somehow achievable with attributes. Which ones do I have to set?

+1  A: 

I'm not very familiar with WebForms but the BrowsableAttribute might be what you are looking for. Also look at the DesignTimeVisibleAttribute.

The System.ComponentModel namespace has a number of other attributes that may do what you need.

orj
BrowsableAttribute is for displaying properties/events in the property window, and wont do anything for the view area.
Simon Svensson
+1  A: 

I'm guessing that the control you refer to, ComponentArt:Grid, have an associated ControlDesigner which can do about anything, including designtime editable areas and custom action menus (the menu associated with the arrow in the upper right corner).

However, Visual Studio does not [last time I tried] execute the control designer for UserControls, so you can not easily control this. There's a lot of magic happening in the background in the UserControlDesigner including parsing the html code. However, I've never seen actual compilation of the codebehind file, where the ControlDesigner attribute would be specified.

You will need to rewrite your control as a server control for Visual Studio to check for the attribute, and allowing your custom designtime view.

Simon Svensson
Overriding the designer of the UserControl does not seem to be possible. I'll mark this answer as accepted
citronas