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));
or
finding the inner value textbox with FindControl("_Editor")
and retrive the content from Request object
Hope it helps
It's on EPiServer 5.1 and i'm converting the code from 4.6. On 4.6 I used CurrentPage.property.add 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.
Think you have to Find the IPropertyControl control inside the ctlHtmlEditor
try
IPropertyControl ctr=ctlHtmlEditor.controls[0] as IPropertyControl
ctr.ApplyChanges();
now I quess the value is set... (sorry about links, using reflector)
Hi
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 ;)
Regards
Per Gunsarfs
EPiServer CMS development team
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
Many nice function here
Edit:typos
Hi,
the other forum post that Per refers to is this,
http://world.episerver.com/Forum/Pages/Thread.aspx?id=19369&epslanguage=en
but I'll think its time for an article about this...
Hi,
Thanks for all the response .
Anders code did the trick.
IPropertyControl ctr = ctlHtmlEditor.Controls[0] as IPropertyControl;
ctr.ApplyChanges();
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.
That was good news
Just for the record, I would have used the SetValuesForPropertyControls(ctlHtmlEditor) insted of ctlHtmlEditor.Controls[0]
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.Name="_Editor";
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.