ASPX templates
Version 6.x > ASPX templates > using CMSeditable regions with .aspx pages that are not templates View modes: 
User avatar
Member
Member
candyce@strategicws.com - 5/10/2012 10:37:03 AM
   
using CMSeditable regions with .aspx pages that are not templates
I have an aspx page that updates a product database. I am not using the Ecommerce module because I have to specify for each product which websites to include it on.

I want to use Kentico's CMSeditable regions (or Kentico's version of CKEditor) on this page so the user can use the editor to add links to the product descriptions that link to other pages within the CMS. How can I do this?


User avatar
Kentico Support
Kentico Support
kentico_radekm2 - 5/11/2012 2:15:01 AM
   
RE:using CMSeditable regions with .aspx pages that are not templates
Hello.

You can use EditableRegion control in your ASPX page template like this:

<cms:CMSEditableRegion runat="server" ID="myER" RegionType="HtmlEditor" RegionTitle="My editable region" />

This class is part of our API, so you don't need to register it as a control.

Best Regards,
Radek Macalik

User avatar
Member
Member
candyce@strategicws.com - 5/11/2012 7:40:15 AM
   
RE:using CMSeditable regions with .aspx pages that are not templates
What do I put in the code behind of the aspx page to get the text entered n the region?

I've seen several examples in the forum but none have worked for me. One example uses a connection string, but I don't know what the connection string should be.

User avatar
Kentico Support
Kentico Support
kentico_radekm2 - 5/16/2012 4:01:46 AM
   
RE:using CMSeditable regions with .aspx pages that are not templates
Hello.

I am not sure what examples do you refer to, but you can do this like this:

//Get PageInfo
System.Guid g = new Guid("68846B3F-1C79-4C9D-8BDB-B4BC0414D2FE");
PageInfo pi = PageInfoProvider.GetPageInfo(g);

//Set value
pi.EditableRegions["toptext"] = "Radek";

TreeProvider tr = new TreeProvider();
TreeNode tn = tr.SelectSingleNode(CMSContext.CurrentDocument.DocumentID);

// Update the content XML
tn.SetValue("DocumentContent", pi.DocumentContent);

// Update the document
DocumentHelper.UpdateDocument(tn, tr);


Best Regards,
Radek Macalik