Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Editor in Custom Web Part View modes: 
User avatar
Member
Member
luyolo.mhlauli-nmmu.ac - 3/27/2012 8:36:08 AM
   
Editor in Custom Web Part
I want to read values from a database and I want to display the in an editor.

I tried this


<%@ Register src="~/CMSWebParts/Text/editabletext.ascx" tagname="Editable" tagprefix="cms" %>

<cms:Editable ID="editable" runat="server" Visible="true" />


and in code I have this

editable.DefaultText = (string)CMSContext.CurrentUser.GetValue("NMMUDuties");

This does not give me any error but it doesnt diplay anything. I cant even see the editor

How can I have an editor in an ascx control reading from a database and how can I get updated values from editor to database ?

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 3/28/2012 2:31:06 AM
   
RE:Editor in Custom Web Part
Hi,

you need to load the content to the editable text web part/control using something like this:

<editableTextID>.LoadContent(CMS.PortalEngine.PageInfoProvider.GetPageInfo(CMSContext.CurrentSiteName, CMSContext.CurrentDocumentParent.NodeAliasPath, "en-GB", null, true));

I hope it will help.

Best regards,
Juraj Ondrus

User avatar
Member
Member
luyolo.mhlauli-nmmu.ac - 3/29/2012 6:58:46 AM
   
RE:Editor in Custom Web Part
I tried it and it displays the text but not in an editor. It works more like a label now

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 3/30/2012 2:26:31 AM
   
RE:Editor in Custom Web Part
Hi,

Could oyu please use the editable text control instead of the web part (cms:CMSEditableRegion)?

Moreover, you need to override and set almost all the properties (like UsesHtmlEditor, GetContent, etc.)

Best regards,
Juraj Ondrus