The LoadText method accepts a physical file, a FileStream, a string or a byte array to load documents into the web editor.
This sample shows how to load a document in the controller and pass it as a ViewModel to the view in order to load a document.
In the controller method Index, the document is loaded into a MemoryStream and then stored in the ViewModel Document that holds the document as a Base64 encoded string. This ViewModel is returned to the actual view.
In the view, the Base64 encoded string is converted back into a byte array and loaded using the LoadText method into the web editor.
Download the sample from GitHub and test it on your own.
Download and Fork This Sample on GitHub
We proudly host our sample code on github.com/TextControl.
Please fork and contribute.
Requirements for This Sample
- Visual Studio 2015 or better
- TX Text Control .NET Server for ASP.NET (trial sufficient)