It is possible to use ASPxHtmlEditor WYSIWYG capabilities to edit rich text, for example, imported from the RTF file.
This example illustrates how to:
- Store real RTF content in a data source;
- Edit this RTF content within ASPxHtmlEditor.
The StandaloneEditor page:
When a page is loaded for the first time, ASPxHtmlEditor imports either RTF content saved in the Session state or a real RTF document located on a web server via the ASPxHtmlEditor.Import method.
An end-user is able to click the custom ASPxHtmlEditor toolbar item to save the changes. To retrieve the modified rich content from the HTML Editor the ASPxHtmlEditor.Export method is used.
The GridEditor page:
- ASPxHtmlEditor is placed into a column’s EditItemTemplate;
- The ASPxHtmlEditor content is populated by handling the ASPxHtmlEditor.Init event: A real column’s RTF data is imported via the ASPxHtmlEditor.Import method.
- When an end-user clicks the Update button, the ASPxGridView.RowUpdating event is raised;
- A reference to the ASPxHtmlEditor is retrieved via the ASPxGridView.FindEditRowCellTemplateControl method;
- A modified RTF content is retrieved from the ASPxHtmlEditor.Html via the ASPxHtmlEditor.Export method and passed back to the datasource.
- Clicking the “More Info” link invokes ASPxPopupControl, which populates its content via its built-in callback functionality. The popup loads the clicked row’s RTF content transformed to the HTML via our cross-platform RichEditDocumentServer engine.
Please note that this example can't run on the Web because it requires file creation during its running, but the file creation is prevented on our example server.