+1-888-365-2779
Try Now
More in this section

Forums / Designing with Sitefinity / Edit Controls in Page defined in Template

Edit Controls in Page defined in Template

6 posts, 0 answered
  1. NEX
    NEX avatar
    25 posts
    Registered:
    14 Aug 2007
    08 Jul 2009
    Link to this post
    I hope I am missing something, but there seems to be a severe limitation with how Templates and the Pages associated with them behave. To clarify, this is what we need to do:

    We need to create a template that has controls that the user can edit when editing the Page that is associated to the Template. As a simple example we have a Template with a Header, Content, Footer areas. The Header and Footer are static and are defined statically in the template. In the Content area we want the template to have an Image control and a generic content control, then an Image control followed by a generic content control. Like this:

    So the Template would basically look like this:

    <Header> 
    <Image control><generic content control>
    <Image control><generic content control>
    <Footer>

    When the user opens the Page to edit it, they can click on either Image control and add their image and click on the generic content control and add their generic content control.

    This is just a simple example, but this basic concept is what is needed, since this truly defines a template to "force" the users to follow the correct format for the page.

    Without this kind of ability the Template/Page relationship is severely handicapped.

    I hope you all have a solution for this, thanks.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    08 Jul 2009
    Link to this post
    Hello Alfred Pena,

    I think that you just need to add two ContentPlaceHolders and then drop Image and GenericContent controls in Sitefinity design mode. By doing so all pages that use this template will have your Image and GenericContent control. If the controls are added to the master page they cannot be edited in page edit mode. This means that the user should add them each time or you can create predefined template pages.

    If your approach is different, let us know.

    Greetings,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. NEX
    NEX avatar
    25 posts
    Registered:
    14 Aug 2007
    08 Jul 2009
    Link to this post
    Taking the example of an Image Control, there is a big difference conceptually with adding an Image Control to a ContentPlaceHolder in a template AND setting it's image to ONLY adding the Image Control without setting it's image. If I set the image then of course I want all pages who use this template to have this image and not be able to update it. However, conceptually, if I don't set the image on the image control then I would want the image control to be editable on all pages that use this template. This seems like a completely reasonable way to do things.

    However I think by your comment "If the controls are added to the master page they cannot be edited in page edit mode." that what I am talking about is impossible to achieve? Please confirm this.

    Our goal is to create several templates that would each have different specific controls available to edit from the Page, so that a uniform look would be easier achieved in the content area. We don't want the user to have to come up with their own specific controls every time they create a new page and choose a specific template. So as a simple example, Template1 would look like this:

    <Header>
    <GenericContent control>
    <Image control>
    <GenericContent control>
    <hr>
    <GenericContent control>
    <Image control>
    <GenericContent control>
    <Footer>

    Template2, Template3, etc would be a variation of the above. So if a user creates a new page and assocites Template1 to it, then they would have this neat predefined controls that they could populate with some different text and images. This would keep all the pages using Template1 to have a similiar order and feel.

    I looked at the the link you provided "predefined template pages." and tested it, but I'm not sure how this could be a pratical solution. It does place an editable generic content control in the specified contentplaceholder, but using that pages example, when a new page is created it automatically selects the "Default" Template. I'm not sure how you would implement this dynamically when you have multiple template possibilities. How could the user slect the template they want for the page they are creating?

    I was thinking that if nothing else works, I hope we can create a custom control to help the users add content in a more controlled way. Using the Template1 example above, can we create a custom control that would encapsulate:

    <GenericContent control>  // for a Title
    <Image control> // for an image
    <GenericContent control> // for some html Text

    So that the user can drag this custom control when creating/editing Pages. They would drag it into a contentplaceholder, then click edit, a window would pop up where they can add the "Title" in a textbox, add an image the same way as if they dragged a sitefinity image control and add the "Text" via a generic content box. This way we can tell the users to drag specific custom controls for specific pages depending what template they want, which would help keep the "similiar order and feel" that we are trying to achieve, since they would be using the same controls rendered and wrapped the way the custom control dictates. If this is possible can you point me in the right direction. I have looked at pages such as http://www.sitefinity.com/help/developer-manual/extending-built-in-controls-example--extending-content-view-control.html but they seem incomplete or have some errors. For example, that link refers to folders and files that do not exist.

    Appreciate any help and sorry for the loooooong post, but we are at a critical point in deciding what we can and can't do and I wanted to be as clear as I could.


  4. NEX
    NEX avatar
    25 posts
    Registered:
    14 Aug 2007
    08 Jul 2009
    Link to this post
    No. What we want is the user to be able to "Edit" a control we place in a template.  We want to prevent the user from adding a control to a content area and force them to use the control we place there.  We don't want to the same content on each page just the control use to edit the content.

    Kentico and many other CMS we reviewed had this ability and we just assumed that Sitefinity would too :|
    Basically when a control is added to a template there should be an option to specify if that control can be
    edited by a user or not.

    Seems like it would be a fairly easy feature to add and an very important one.  I hope you won't make
    us have to return to Kentico...
  5. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    10 Jul 2009
    Link to this post
    Hello Alfred Pena,

    Thank you for elaborating.
    We will definitely discuss this. You can use the following sample code in your masterpage code behind:
    using System;    
    using System.Collections.Generic;    
    using System.Web;    
    using System.Web.UI;    
    using System.Web.UI.WebControls;    
    using System.Web.Security;    
    using Telerik.Security;    
    using System.Web.Profile;    
    using Telerik.Cms.Web;    
       
       
    public partial class App_Master_JAIHChild : System.Web.UI.MasterPage    
    {    
        protected void Page_Load(object sender, EventArgs e)    
        {    
            if (UserManager.IsCurrentUserInRole("Editors") && UrlHelper.EditModeKey.Contains("cmspagemode"))    
            {    
                Control holder = CmsHelper.FindControl(this"RestrictedPlaceHolder");    
                if (holder != null)    
                    holder.Visible = false;    
            }      
       }    
       
    }    
     
    in order to hide the place holder if the user is in certain role, but the "Edit" functionality will be hard to be achieved with the current implementation. Anyway, notes are taken.

    Sincerely yours,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. NEX
    NEX avatar
    25 posts
    Registered:
    14 Aug 2007
    10 Jul 2009
    Link to this post
    Ok. Thanks.  In general you want to give the users the option to make a choice instead of not having the choice at available at all :) 
Register for webinar
6 posts, 0 answered