Products Technologies Demo Docs Blog Support Company

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.

DataSourceManager: Using the Ready-to-Use Reporting Dialog Boxes

The TXTextControl.DocumentServer namespace encapsulates the Text Control reporting functionality, the TXTextControl.DocumentServer.Fields.FieldAdapter class, the TXTextControl.DocumentServer.DataSources.DataSourceManager class and also reporting dialog boxes that can be used in your applications.

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.

    ChartDataRelationDialog

  • 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 TXTextControl.DocumentServer.DataShaping.SortingInstruction class list to the TXTextControl.DocumentServer.DataSources.MergeBlockInfo 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();

    FilterAndSortDialog

  • 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();

    DatabaseConnectionDialog

  • 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();

    EditDataRelationsDialog

  • 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();

    EditMergeBlocksDialog

  • 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();

    InsertMergeBlockDialog

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.

Stay in the loop!

Subscribe to the newsletter to receive the latest updates.

Also See

This post references the following in the documentation:

  • TXTextControl.DocumentServer.DataShaping.SortingInstruction Class
  • TXTextControl.DocumentServer.DataSources.DataSourceManager Class
  • TXTextControl.DocumentServer.DataSources.MergeBlockInfo Class
  • TXTextControl.DocumentServer.Fields.FieldAdapter Class
  • TXTextControl.DocumentServer 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.

See Reporting products

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.


ActiveXASP.NETReporting

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.


ActiveXASP.NETReporting

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.


ActiveXASP.NETReporting

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.


ActiveXASP.NETReporting

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.