Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Make editable image inherit on certain pages View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
adam - 9/7/2011 11:01:19 AM
   
Make editable image inherit on certain pages
I'm using the portal templates and have a usercontrol like this.

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Banner.ascx.cs" Inherits="Controls_Banner" %>
<cms:CMSEditableImage ID="BannerEditable" runat="server" ImageHeight="953" ImageWidth="129" ImageCssClass="banner" ToolTip='<%=CMSContext.CurrentDocument.DocumentName %>' InheritContent="true" />


what i want to do is allow the image to be editable and different on all but a few pages that meet the following condition. so in the usercontrol code behind i have this.

 protected override void OnPreRender(EventArgs e)
{
if (CMSContext.CurrentDocument.NodeClassName == "document.class")
{
base.OnPreRender(e);
BannerEditable.LoadContent(CMS.PortalEngine.PageInfoProvider.GetPageInfo(CMSContext.CurrentSiteName, "/Products", CMSContext.CurrentDocumentCulture.CultureCode, null, true, CMS.DataEngine.ConnectionHelper.GetConnection()));
BannerEditable.SaveContent(CMS.PortalEngine.PageInfoProvider.GetPageInfo(CMSContext.CurrentSiteName, CMSContext.CurrentDocument.NodeAliasPath,CMSContext.CurrentDocumentCulture.CultureCode, null, true, CMS.DataEngine.ConnectionHelper.GetConnection()));
}
}


this will display the correct image in the cms edit mode but wont display on the live site until i click save.

i've tried using the node.update() as outlined here http://devnet.kentico.com/docs/devguide/update_document.htm

any ideas?

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 9/8/2011 3:14:41 AM
   
RE:Make editable image inherit on certain pages
Hi,

if you need to inherit a content of editable image web part control you can insert this web part on a some parent page and inherit from it. In Properties of document - Templates tab - Select inherited levels. Here you can define where the content (editable image) which should be inherited is. In other words - document which should inherit the image has to use a different template.

Best regards,
Ivana Tomanickova



User avatar
Certified Developer v7
Certified  Developer v7
adam - 9/26/2011 4:40:51 AM
   
RE:Make editable image inherit on certain pages
this is not using a web part but a cms editable image which i have used before but on aspx templates.

is there a way of saving the content which is loaded?

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 10/3/2011 2:07:43 AM
   
RE:Make editable image inherit on certain pages
Hi,

the path to image is stored in a DocumentContent field (CMS_Document table). Therefore you need to work with document API to store the image as you need. You will need to update the column if you would like to customize the behavior. You can follow this API example. Instead of NewsSummary column you need to work with DocumentContent:
Update Document

Best regards,
Ivana Tomanickova