I am adding the Content Editor pro grammatically in my custom wp (into the asp.net Panel), where I am pre-loading the CEWP with some contents. But the issues is once added pro grammatically. I do not get an option to add any contents from the UI anymore. Any thoughts?
2 Answers
Is this during edit mode (i.e. edit webpart), or during regular view? if regular view, the control will just render the text, and is non editable. But tell me, why would you add the content editor webpart IN your webpart? If it is a custom webpart anyway, just create an editorpart which allows a user to fill in fields (i.e. webpart properties) during edit mode and which can be set declaratively (using xml when deploying in a feature) or in code.
-
Essentially what I want is to pre-load the existing content editor with some text. So I am creating a custom wp that will act like a wrapper to the existing content editor and add some text to it. Suggestions on a better approach?– Hna0002Nov 4, 2011 at 14:50
How are you adding this webpart? declaratively in CAML or programmatically in .NET?
Here is an example in .NET code of how to set some initial content when adding CEWP:-
Here is an example of doing it within CAML in an onet.xml file:-
http://akurniaga.wordpress.com/2011/02/24/add-content-editor-web-part-into-site-template/