Question

I want to do something like this:

I got this User Control called Base:

<div>
some content...

<asp:ContentPlaceHolder id="baseContentPlaceHolder" runat="server"></asp:ContentPlaceHolder>

</div>

Then i inherit the Base in another User Control and add stuff to the content:

<asp:Content id="subBase" contentplaceholderid="baseContentPlaceHolder" runat"server">
    stuff to be added...
</asp:Content>

Is it possible to do with ContentPlaceHolder ?

How can this behavior be solved?

Was it helpful?

Solution

I don't think you can do that.

A ContentPlaceHolder can only go in the MasterPage itself.

In the pages that inherit from the MasterPage, you put in a Content tag.

My best guess would be to add in a PlaceHolder, expose that on the control, and then add in your stuff to that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top