The MVC version of TXTextControl.Web provides an HtmlHelper to support the rendering of the HTML5-based editor in a view.

In the HtmlHelper, all properties can be adjusted and methods can be called to load documents or to load a database. In order to render the default view of TXTextControl.Web, the following simple razor code is required:

@using TXTextControl.Web
@using TXTextControl.Web.MVC
@Html.TXTextControl().TextControl().Render()
view raw Index.cshtml hosted with ❤ by GitHub

In order to set properties of the TXTextControl.Web object, lambda expressions can be used. The following razor code shows how to set several properties that will be applied automatically when rendering the control:

@Html.TXTextControl().TextControl(settings =>
{
settings.DocumentTargetMarkers = true;
settings.DocumentFileDirectory = Server.MapPath("~/App_Data/Documents");
settings.TableGridLines = false;
settings.StatusBarColor = System.Drawing.Color.Red;
settings.BackColor = System.Drawing.Color.Yellow;
settings.Dock = TXTextControl.Web.DockStyle.Window;
}).Render()
view raw Index.cshtml hosted with ❤ by GitHub

Additionally, methods can be called in the HtmlHelper. The following code snippet loads a document and loads an XML database for the Reports ribbon tab:

@Html.TXTextControl().TextControl(settings =>
{
settings.Dock = TXTextControl.Web.DockStyle.Window;
}).LoadText(Server.MapPath("~/App_Data/Documents/invoice.docx"),
StreamType.WordprocessingML).LoadXMLDatabase(
Server.MapPath("~/App_Data/DataSources/sample_db.xml")).Render()
view raw Index.cshtml hosted with ❤ by GitHub