This is a migrated thread and some comments may be shown as answers.

[Solved] Can an Editor be added to Placeholder with Code?

2 Answers 268 Views
Editor
This is a migrated thread and some comments may be shown as answers.
bdk0172
Top achievements
Rank 1
bdk0172 asked on 24 Mar 2008, 08:38 PM

I followed the directions from this thread(http://www.telerik.com/community/forums/thread/b311D-bbkaaa.aspx) to copy the Default skin folder to my project and I registered the css in the ASPX page.  On my page, I have a placeholder and a button inside an UpdatePanel.  In the button's Click event, I have the following code, but I don't get a new editor when I click it. 

RadEditor

re = new RadEditor();

re.ID =

"re" + editorCount.ToString();

re.Height =

Unit.Pixel(400);

re.Width =

Unit.Pixel(800);

re.EditModes =

EditModes.All;

re.Skin =

"Default";

re.EnableEmbeddedSkins =

false;

string[] images = new string[] { "~/AssocImages" };

re.ImageManager.ViewPaths = images;

re.ImageManager.UploadPaths = images;

re.ImageManager.DeletePaths = images;

re.ImageManager.MaxUploadFileSize = 50000000;

string[] docs = new string[] { "~/AssocDocuments" };

re.DocumentManager.ViewPaths = docs;

re.DocumentManager.UploadPaths = docs;

re.DocumentManager.DeletePaths = docs;

re.DocumentManager.MaxUploadFileSize = 50000000;

editorCount++;

phContent.Controls.Add(re);

2 Answers, 1 is accepted

Sort by
0
bdk0172
Top achievements
Rank 1
answered on 25 Mar 2008, 02:24 PM
Here's a little more explanation of what I'm trying to achieve.  We're creating basically a web page builder and we want to give the user the ability to create multiple sub-sections of a page.  Initially, we will display one editor which the user can edit. 

Then, if they want to create another sub-section, they will click on an Add button and we will display for them a new editor control.  Then they can enter information into the new editor.

We want them to be able to repeat this as many times as they want. 

I had seen another post that had a sample using saving and loading of viewstate to keep track of how many new controls were added and to retain all of them during a postback, but it was creating new controls each time.  I want to be able to retain the controls and their contents each time the Add button is clicked.
0
George
Telerik team
answered on 27 Mar 2008, 02:19 PM
Hi Brian,

We are not quite sure if we understand completely your setup, but we believe that this task is not directly related to the RadEditor control. That is why we suggest to implement the desired logic not with RadEditor but by using a standard textbox.

Once you have your logic working as expected - e.g. the controls are loaded as you want them, you will only need to replace the textbox with the RadEditor control. If your logic is working fine with the standard control but you have problems replacing the textbox with RadEditor, please send the working project to us and we will make the necessary changes for you.



Best regards,
George
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Editor
Asked by
bdk0172
Top achievements
Rank 1
Answers by
bdk0172
Top achievements
Rank 1
George
Telerik team
Share this question
or