views:

453

answers:

0

I am developing a simple email marketing web application with ASP.NET MVC 1.0. I have setup CKEditor 3.1 on a textarea in a view, the HTML editor renders fine. I can save the HTML content from the textarea with a POST to the controller.

The application needs to provide some "starter" HTML email templates to users for preparing an email campaign. I have a folder "HTMLEmailTemplates" where each HTML template (CSS embedded within the HTML file, all images in the same folder as the HTML file) is arranged in their individual folder (such as "template1", "template2", etc). I wish to provide the ability to a user to load one of these templates into the textarea (which is setup with CKEditor 3.1, using the fullPage : true configuration option).

My initial attempt to do the above by reading the HTML template file using a StreamReader in the controller, passing the string through ViewData to the view and using the string as a source for the textarea resulted in the HTML template being visible without the images in the HTML editor.

My questions -

  1. What is the correct way to load a HTML template (with images) from the server into a textarea setup with CKEditor?

  2. Once the user has edited the HTML, should I simply use the POST to the controller to save the edited HTML template? (At this stage, I do not need to provide with the ability to upload and embed images in the HTML template)

Thank you for your help. indyfromoz