Try our conversational search powered by Generative AI!

Innerproperty and html-editor


After a postback i'm showing a html-editor on a EPiServer simplepage.

<EPiServer:Property id="ctlHtmlEditor" EditMode="true" runat="server" />

I'm adding the value to the property by using the innerproperty. I'm doing thing in the pageinit event.

PropertyXhtmlString oEditor = new PropertyXhtmlString();
oEditor.EditorToolOptions = EPiServer.Editor.EditorToolOption.All;
ctlHtmlEditor.InnerProperty = oEditor;

So far everything is fine. But efter postback/submit i'm unable to access the value of the property. I have tried ctlHtmlEditor.PropertyValue and ctlHtmlEditor.InnerProperty.Value.

Nov 03, 2008 7:38

I quess this is on EPiServer 4?

Had the same problem a while ago, dont remember what I did but it was either

bool test = true;
_prop.ParseValidation(null,new ServerValidateEventArgs(_prop.ToString(), test));


finding the inner value textbox with FindControl("_Editor")
and retrive the content from Request object

Hope it helps

Nov 03, 2008 12:27

It's on EPiServer 5.1 and i'm converting the code from 4.6. On 4.6 I used insted of using the innerproperty but it's not possible anymore. The property.add i "read only" in EPiServer 5.

I got the code working using Request object but it feels wrong.

Nov 03, 2008 12:48

Think you have to Find the   IPropertyControl control inside the ctlHtmlEditor


IPropertyControl ctr=ctlHtmlEditor.controls[0] as IPropertyControl 


now I quess the value is set... (sorry about links, using reflector)

Nov 03, 2008 15:13


I'm assuming your code is on a page that in some form inherits from PageBase. What you need to do is to call the method PrepareForSave(), that you can find on PageBase, before you check the value.

PrepareForSave() will call ApplyChanges() on all controls that are of the type IPropertyControl which will set the value, as Anders said.

Also you need to make sure that your PropertyXhtmlString is writeable.

I think Linus Ekström wrote a good forum reply regarding this, too lazy to find it now though ;)


Per Gunsarfs
EPiServer CMS development team

Nov 03, 2008 16:40

I think the CurrentPage is ReadOnly in the scheme is Thomas describing. So that function Per is pointing to would not work,  but the function that PreperForSave is using SetValuesForPropertyControls(Control control) looks like it does the trick.

Havent looked in PageBase in a long time I see Embarassed
Many nice function here



Edited, Nov 03, 2008 20:09


the other forum post that Per refers to is this,

but I'll think its time for an article about this...

Nov 03, 2008 20:55


Thanks for all the response Smile.

Anders code did the trick.

IPropertyControl ctr = ctlHtmlEditor.Controls[0] as IPropertyControl;

I then used ctlHtmlEditor.PropertyValue.ToString() to access the value. I first tried the PrepareForSave but not luck there. The other thread hade no solution for this what I could find.

Nov 03, 2008 21:41

That was good news

Just for the record, I would have used the SetValuesForPropertyControls(ctlHtmlEditor) insted of ctlHtmlEditor.Controls[0]  Laughing

Nov 03, 2008 22:07
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.