ContentPlaceHolder in UserControl

Posted by Community Admin on 05-Aug-2018 09:41

ContentPlaceHolder in UserControl

All Replies

Posted by Community Admin on 21-May-2011 00:00

Wouldn't it be nice if we could drag widget content into our own user controls?
Then we could have ad rotators and list controls be configured easily by drag and drop. This would make it possible to create many different types of controls that would otherwise require complex widget designers to create. 

Posted by Community Admin on 23-May-2011 00:00

Hi Jaime,

You can use datasource controls to bind your widgets, but generally the UI is supposed to be used by end users that will add content., so binding complex controls and adding content to them from the UI is quite complex and it wouldn't be something that an contend edit will understand.

Greetings,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 23-May-2011 00:00

Dear Ivan

One amazing end-user appreciated feature would be the ability to use Content - content blocks in content blocks.

Content - Content Block (Better naming would be shared content - same name used twice) for example has a simple name and phone number.

Then users drag a content block to pages and start writing.

Please contact our staff member <content block (shared contend)> for further assistence.

If John Doe 555 - 435 564 leave the company and is replaced by Jane Doe 555- 435 566 you only would have to change the (Shard content - content block)

This could be used in so many occasions

- Phone numbers
- Prices
- VAT Numbers
- VAT tax values
- contacts
- opening hours

Some times you can have such information in a seperate block but sometime its better to have it included in the text directly.

Markus

Posted by Community Admin on 23-May-2011 00:00

Hello Markus,

The RadEditor control has full set of features that allow you inject a custom template though its TemplateManager(demo demos.telerik.com/.../defaultcs.aspx)

Kind regards,
Ivan Dimitrov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 23-May-2011 00:00

Dear Ivan

Correct me if I am wrong

a) custom templates work once when inserting (no automatic updating)
b) cutom templates need to be programmed, wich is in 4.1 still a bit of work (looking forward to a KB about tools in 4.1 or the settings implementation expected in 4.2)
 
If both above are true, then I would be looking for a dynamic out of the SF box solution, since its under the section Suggestions and not how to develope with SF :-)

Markus

Posted by Community Admin on 29-Oct-2011 00:00

The flexible template section
If you take time to understand what I am proposing you will actually have to rethink about why this is a very important missing feature.

My choices really go against my design principles
I have various choices when I want to make a fluid expandable container (one of the problems that usercontrols that supported contentplaceholders would solve) and none are flexible for my clients. These containers need to have header and footer and repeating background images. This can't be accomplished by adding a couple css classes to the columns in the layout editor. I also want to reuse the containers all over the website in different templates and pages. PLEASE AND THANK YOU FOR OPTION 4

Option 1: From the code file template
The first option is that I can create a master page in a file (I don't like extra code files). I create the expandable section and then I embed a contentplaceholder inside that section and then I get a nice place to drop things. This really gets the job done but my clients inevitable call me on the telephone telling me that they can't delete update the background. I say, "yeah, that is suppose to keep you from messing things up". And they say, "yeah, but I don't like the way it looks". The client also wants to be able to use that expandable section in other columns including the ones added by the Sitefinity layout designer. This is really the only option but it is far from desirable.

Option 2: Hard-coded in the pages or templates
Another option is to put layout information into a generic content control and drop it in there. Needless to say adding div to the radeditor content is a recipe for disaster. The client almost always deletes something in the content or deletes the control completely and I get another lovely phone call. 

Option 3: Splitting code among multiple usercontrols in the template
This creates a lovely mess when add the starting div in the first usercontrol and the parser can't find the end tag. If you are lucky you can enter the end tag before the opening tag and it sometimes works. It takes about ten times as much space because you have three vertical placeholders (header, content, footer). It is also ugly in the page that is using the template because it only renders correctly and runtime or preview time. I shouldn't have added this one but it worked a long time ago.

Option 4: Elegant custom template sections
This option is kind of like a template for a layout section that you can drag anywhere on the template. Call it what you will--a usercontrol with a content placeholder or a custom template section( just like the drag n drop multiple column layouts you can use but with content or styles attached). Heck, you could even add properties to these template sections for  their header's text and footer's text or other properties. This way I would never get that phone call from my client whining about the inflexibility of the layout. 

Posted by Community Admin on 02-Nov-2011 00:00

Hi Jaime,

I understand what you suggestion mean and it actually is very good suggestion, but in the case with the design of the widgets which are standalone controls this will not be possible. To achieve what you desire I have a partial solution creating custom layout controls that can be used to nest multiple widgets.

I have attached a sample custom layout control with tabs that is showing in preview and rendering properly in preview. Please examine this approach which is different from the one mentioned in the forum and tell me if it works for you.
To register the control add App_Code folder and place the code file in it. The template can remain in the root folder.
To register the control
ControlType: SitefinityWebApp.App_Code.Crisis, App_Code
LayoutTemplate: ~/LayoutControlTemplate.ascx

Greetings,
Stanislav Velikov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 15-May-2012 00:00


I think what I want to do is fairly simple, however I cannot figure it out.

I would like to make my own layout widget and am following the directions here to do so. www.sitefinity.com/.../using-external-widget-template-file

I can get my user control to show up in the toolbox, but when I drag it onto my page it does not show the content placeholder areas for me to drag content. What else do I need to do?

This is the code to my user control:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Columns-7-5.ascx.cs" Inherits="SitefinityWebApp.App_Master.Layouts.Columns_7_5" %>
 
<div runat="server" class="section clear">
    <div runat="server" class="col7">
        <br />
         
    </div>
    <div runat="server" class="col5">
        <br />
    </div>
</div>

Here is the registry in ToolboxesConfig.config:
<toolbox name="PageLayouts">
    <sections>
        <add name="TwoColumns">
            <tools>
                <add enabled="True" type="Telerik.Sitefinity.Web.UI.LayoutControl" title="Column-5-7" layoutTemplate="~/App_Master/Layouts/Columns-7-5.ascx" visibilityMode="None" name="Column-5-7" />
            </tools>
        </add>
    </sections>
</toolbox>

And this is what it looks like on the Toolbox:
cl.ly/2z0z3n1D0x3i3N143u2i

And this is what it looks like on the page - no content placeholders: cl.ly/2S1a200B3R0O3C352W0W

How do I add content placeholders?

This thread is closed