The most typical application for the Web.TextControl is the creation of templates for the Text Control Reporting engine DocumentServer.MailMerge. The ribbon tab Reports is designed to insert merge fields and merge blocks compatible to the reporting classes of TX Text Control.
The drop-down buttons Select Master Table, Merge Field and Merge Block are pre-filled with items of a specific Database Excerpt XML file or a DataSet that can be loaded programmatically.
Typically, the template is merged server-side with a business object created from a class model. In this case, it makes sense to pre-fill the drop-down lists from a view model as well. The following simple model is used in this sample:
Note the Serializable attribute in the class model. In the controller, the model object is created and typically filled with data from a database. After that, the object is serialized and stored in the ViewBag:
In the view, the LoadXMLDatabase method loads the stored XML document from the ViewBag:
The drop-down lists are now pre-populated with the available merge fields and merge blocks:
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 2012 or better
- TX Text Control .NET Server for ASP.NET (trial sufficient)