Control skins cannot contain child controls


D

Dave Mathew

I'm having problems implementing a custom server control that I'd like
to use a skin. What I'm trying to accomplish is building a control
that I can drop into a page and change a property of this control that
is a collection through the use of a theme's skin file. Like this:

<tpx:AControlName SkinID="skinname" runat="server" />


Then in a skin file for each theme define the collection (where the
myitems would be different for each theme):

<tpx:AControlName SkinID="skinname" runat="server>
<myitem myproperty="myvalue1" myproperty2="myvalue2" />
<myitem myproperty="myvalue3" myproperty2="myvalue4" />
</tpx:AControlName>


I've currently implemented a control that uses a ControlBuilder and an
override of the AddParsedSubObject method to parse out each "myitem"
in the markup and add items to a private list in my control. Then I
use the Render method to generate the markup I want based off of the
data in the list.

This works fine when all the markup for the control is in the page
it's being used on. However when I add on the SkinID and move the list
of "myitems" to the skin file I get this error when compiling:

"Control skins cannot contain child controls"

It seems that only "presentation properties" can be skinned but I
can't seem to find any documentation on why this is the case or even
what a "presentation property" is. Any advice would be greatly
appreciated.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top