Try our conversational search powered by Generative AI!

Dynamic Content XHTML-editor

Vote:
 

 Hi,

I'm trying to insert dynamic content from the editor. The dynamic content should be a new editor that looks like the one I'm inserting it from. I have managed to make a new editor show up but I don't know how to save it in the correct way. I have only managed to save and show the content in the editor if its text like <p> hello </p> (in a Literal Control). If I try to add a image, the dynamic content box looks like this instead of the orange dynamic content box that I should get.

" hash="+yWD3tOtgAUjHGkjgWAjTl/YGZL/7fPrNTKfXnjKN7s=" disabled="disabled" contentEditable="false" class="dynamiccontent" style="border: 1px solid #111111; background-color: #F8EDA4; padding: 3px;">{DynamicContent:Free text editor} 

If I try to "Save and publish" I get : "No hash value found".

Does anyone know how to save it, and in what kind of control I should try to show it(right now I'm trying to use a asp:Literal).

Here is code fron my FreeTextEditorSettings.ascx.cs (for editmode)

string g = "";         override protected void OnInit(EventArgs e)         {             PropertyXhtmlString oEditor = new PropertyXhtmlString();             oEditor.Name = "_Editor";             oEditor.EditorToolOptions = EPiServer.Editor.EditorToolOption.All;             ctlHtmlEditor.InnerProperty = oEditor;         }         protected void Page_Load(object sender, EventArgs e)         {             if (!IsPostBack)             {                 txtHeadline.Text = ((FreeTextEditor)Content).Headline.ToString();                 txtFreeText.Text = ((FreeTextEditor)Content).FreeText.ToString();                 g = ((FreeTextEditor)Content).Editor.ToString();
//g should be the editor but I don't know how to read back to it. } } public override void PrepareForSave() { ((FreeTextEditor)Content).Headline = txtHeadline.Text; ((FreeTextEditor)Content).FreeText = txtFreeText.Text; IPropertyControl ctr = ctlHtmlEditor.Controls[0] as IPropertyControl; ctr.ApplyChanges(); ((FreeTextEditor)Content).Editor = ctlHtmlEditor.PropertyValue.ToString(); }
Hope sombody can help me!
#26148
Nov 21, 2008 16:47
Vote:
 

Hi

 Made something simular too Roar. Sjekk out this thread http://world.episerver.com/Forum/Pages/thread.aspx?id=26016

Is some code there. You need to change Properties  to something like this

_properties = new PropertyDataCollection();
PropertyXhtmlString prop=new PropertyXhtmlString();
prop.EditorToolOptions=EditorToolOption.All;
_properties.Add("Comment", prop);

and of course change the GetControl to something like this

   IPropertyControl control = PropertyControlClassFactory.Instance.CreatePropertyControl(Properties["Comment"]  );
        control.PropertyData = propertyData;
        control.Properties = Properties;
        control.RenderType = RenderType.Default;
        control.SetupControl();
        return (Control) control;

The case is that the State has to be hex64 encoded. I dont understand why that is not buildt in Frown

http://world.episerver.com/en/Blogs/Anders-Hattestad/Dates/2008/10/Dynamic-content-and-State-attribute/

hope this helps

#26151
Edited, Nov 21, 2008 18:15
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.