Web.TextControl is a Web Forms ASP.NET component that can be also integrated into MVC without breaking the MVC rules. This tutorial shows how to implement the HTML5 editor within ASP.NET MVC.
Basically, the ActionResult TemplateEditor executes an ASPX page with the Web.TextControl in memory in order to render the content as a string.
In this concept, we can still use code-behind to load and save documents without losing the Controller routes and logic. But when saving a document inside the ASPX page, we might want to know that in the MVC Controller in order to store the data in a database.
Therefore, the Controller gets a new HttpPost method SaveDocument:
This method accepts two strings the document name and the document itself in the RTF format. In the ASPX page, the document is saved on a button click within an AJAX UpdatePanel:
In code-behind, the document is saved as RTF in a string variable and a new WebRequest object is used to call the new Controller method SaveDocument. The document name and the document itself are encoded as a byte array and posted to the Controller.
This way, you can synchronize your Controller logic and save documents inside your Controller code.
We didn't release the official roadmap for version X13 yet, but this we can already announce: We will release an MVC version of Web.TextControl soon including a Nuget package and a pure MVC model.
Download the sample from GitHub and test it on your own.