DataSourceManager: Using the Ready-to-Use Reporting Dialog Boxes
The Text Control DocumentServer class comes with ready-to-use dialog boxes for various purposes. This article shows how to use them in your application.

The TXText
These dialog boxes are ready-to-use for typical data selection tasks. The following dialog boxes are available:
-
ChartDataRelationDialog
This dialog is used to set the data relations for charts.The following code loads a data source into a new instance of a DataSourceManager and opens a chart data relation dialog for a selected chart frame in TextControl:
DataSourceManager dsManager = new DataSourceManager(); dsManager.LoadSingleObject(report); TXTextControl.DocumentServer.Windows.Forms.ChartDataRelationDialog dlg = new ChartDataRelationDialog(textControl1.Charts.GetItem(), dsManager); dlg.ShowDialog();
The dialog lets the user select the parent and child tables that define the data relation and two data columns in the child table that are used as the x-axis label text and the actual data.
-
FilterAndSortDialog
This dialog is used to specify the filter and sorting settings for a merge block.The following code opens an instance of the dialog and passes the TXText
Control. list to the TXTextDocument Server. Data Shaping. Sorting Instruction class Control. :Document Server. Data Sources. Merge Block Info class DataSourceManager dsManager = new DataSourceManager(); dsManager.LoadSingleObject(report); FilterAndSortDialog filterSortDialog = new FilterAndSortDialog(dsManager.MasterDataTableInfo); filterSortDialog.ShowDialog(); MergeBlockInfo mergeBlockInfo = new MergeBlockInfo("TableName"); mergeBlockInfo.SortingInstructions = filterSortDialog.SortingInstructions.ToList();
-
DatabaseConnectionDialog
This dialog allows the user to build connection strings and to connect to specific data sources.The following code opens an instance of the dialog. The connection string is applied to the DataSourceManager:
DataSourceManager dsManager = new DataSourceManager(); dsManager.LoadSingleObject(report); TXTextControl.DocumentServer.Windows.Forms.DatabaseConnectionDialog dlg = new DatabaseConnectionDialog(dsManager); dlg.ShowDialog();
-
DataSourceExtractionDialog
This dialog allows the user to save an excerpt from the currently loaded data source. An upper limit of extracted data rows can be specified in the dialog.The following code opens an instance of the dialog. The dialog returns the filename, the maximum number of exported rows and the selected DataTable:
DataSourceManager dsManager = new DataSourceManager(); dsManager.LoadSingleObject(report); TXTextControl.DocumentServer.Windows.Forms.DataSourceExtractionDialog dlg = new DataSourceExtractionDialog(dsManager); dlg.ShowDialog(); var fileName = dlg.FileName; var maxRows = dlg.MaxRows; var selectedTable = dlg.SelectedTable;
-
EditDataRelationsDialog
This dialog allows the user to add or remove data relations to or from the current data source.The following code opens an instance of the dialog. The relations are applied to the connected DataSourceManager automatically:
DataSourceManager dsManager = new DataSourceManager(); dsManager.LoadXmlFile("sample_db.xml"); TXTextControl.DocumentServer.Windows.Forms.EditDataRelationsDialog dlg = new EditDataRelationsDialog(dsManager); dlg.ShowDialog();
-
EditMergeBlocksDialog
This dialog allows the user to remove or rename merge blocks contained in the current document.The following code opens an instance of the dialog with a connected TextControl instance that has merge blocks added to a document:
DataSourceManager dsManager = new DataSourceManager(); dsManager.LoadSingleObject(report); TXTextControl.DocumentServer.Windows.Forms.EditMergeBlocksDialog dlg = new EditMergeBlocksDialog(dsManager, textControl1); dlg.ShowDialog();
-
InsertMergeBlockDialog
This dialog allows the user to design and insert a merge block based on the currently selected master table. It is inserted at the current input position of a given TextControl instance.The following code opens an instance of the dialog with a connected TextControl instance and the selected DataTableInfo object:
DataSourceManager dsManager = new DataSourceManager(); dsManager.LoadSingleObject(report); TXTextControl.DocumentServer.Windows.Forms.InsertMergeBlockDialog dlg = new InsertMergeBlockDialog(dsManager, textControl1, dsManager.DataTables["Products"]); dlg.ShowDialog();
Text Control comes with out-of-the-box UI elements to create powerful reporting applications. At the same time, it is completely customizable and programmable.
Also See
This post references the following in the documentation:
- TXText
Control. Document Server. Data Shaping. Sorting Instruction Class - TXText
Control. Document Server. Data Sources. Data Source Manager Class - TXText
Control. Document Server. Data Sources. Merge Block Info Class - TXText
Control. Document Server. Fields. Field Adapter Class - TXText
Control. Document Server Namespace
Reporting
The Text Control Reporting Framework combines powerful reporting features with an easy-to-use, MS Word compatible word processor. Users can create documents and templates using ordinary Microsoft Word skills. The Reporting Framework is included in all .NET based TX Text Control products including ASP.NET, Windows Forms and WPF.
Related Posts
ReportingWindows FormsMail Merge
MailMerge: Conditional Rendering of Merge Blocks
Merge blocks can be used to render content conditionally. This article explains different ways to control this.
TX Text Control 32.0 Has Been Released
We are pleased to announce the immediate availability of TX Text Control 32.0 for all platforms including ASP.NET, Windows Forms, WPF and ActiveX.
TX Text Control 31.0 and TX Spell .NET 10.0 Have Been Released
We are happy to announce the immediate availability of TX Text Control 31.0 for all platforms including ASP.NET, Windows Forms, WPF and ActiveX and TX Spell .NET 10.0 for all .NET based platforms.
TX Text Control 30.0 and TX Spell .NET 9.0 Have Been Released
We are happy to announce the immediate availability of TX Text Control 30.0 for all platforms including ASP.NET, Windows Forms, WPF and ActiveX and TX Spell .NET 9.0 for all .NET based platforms.
TX Text Control X19 and TX Spell 8.0 Have Been Released
We are happy to announce the immediate availability of TX Text Control X19 for all platforms including Windows Forms, WPF and ASP.NET and TX Spell .NET 8 for all .NET based platforms.