ASPX templates
Version 4.x > ASPX templates > Adding a editable text web control in a .aspx page in visual studio 2008 View modes: 
User avatar
Member
Member
ritchamp - 11/17/2011 9:10:41 AM
   
Adding a editable text web control in a .aspx page in visual studio 2008
Hi,

I need to show an editable region in my aspx page so that administrator can edit the content when needed.

Since it is an ASPX page template, not portal template, i used following steps to inherit the editable text web part.

1. i tried to directly inherit the editable text web part in my aspx page.

<%@ Register TagPrefix="UC" TagName="EditableText" Src="~/CMSWebParts/Text/editabletext.ascx" %>
<UC:EditableText ID="editableText" runat="server" RegionType="HtmlEditor" HtmlAreaToolbarLocation="Out:FCKToolbar" WordWrap="true"
CheckPermissions="false" SelectOnlyPublished="false" />

with the above code i got following error:

You must enable Web Parts by adding a WebPartManager to your page. The WebPartManager must be placed before any Web Part controls on the page.

2. i created a new user control (.ascx) and placed the above code. i inherited the user control in my aspx page.

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="MyTestPage.ascx.cs" Inherits="CMSWebParts_GapWebParts_MyTestPage" %>
<%@ Register TagPrefix="UC" TagName="EditableText" Src="~/CMSWebParts/Text/editabletext.ascx" %>
<UC:EditableText ID="editableText" runat="server" RegionType="HtmlEditor" HtmlAreaToolbarLocation="Out:FCKToolbar" WordWrap="true"
CheckPermissions="false" SelectOnlyPublished="false" />

With this change i was able to get the editable text, in my aspx page, but when i edit the content and click on save, it is throwing following error.

Error Message: A validation error has occurred.

A potentially dangerous Request.Form value was detected from the client (ctl00_plcMain_ucEdiatbleText_editableText_fckValue="...sting.....<br />").

Could you please help me to resolve this issue. Am i missing any attributes in my code.


User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 11/21/2011 2:28:47 AM
   
RE:Adding a editable text web control in a .aspx page in visual studio 2008
Hi,

what version of Kentico CMS do you use?

Here is a tutorial how to add an editable region to the ASPX template in Kentico 4.1:
http://devnet.kentico.com/docs/4_1/tutorial_aspx/creating_a_simple_aspx_page_template.htm

I hope it helps you.

Best regards,
Ivana Tomanickova