Reputation: 19365
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.
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?
Upvotes: 0
Views: 1730
Reputation: 31116
Visual studio doesn't support this. The moment you specify the word "user control", the thing goes beserk and renders everything you put on it.
Fortunately you can influence how server controls are rendered. In other words, you can cheat the Visual Studio designer by making use of that. The code you need can be found here: http://www.codeproject.com/Tips/773145/Hiding-contents-in-ASP-Net-user-control-designer
Upvotes: 0
Reputation: 19781
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.
Upvotes: 1
Reputation: 13484
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.
Upvotes: 1