3rd Party Tools Frequently Asked Questions
How can I use DevExpress XtraReports with Data Abstract for .NET?
In this step-by-step tutorial the new XtraReports report will be added to the C# Windows Forms
sample.
- Create a new report page using XtraReport Wizard.
Note: When the wizard asks you about connection, tables, fields, etc., try to present a data structure to the wizard exactly as DataAbstract data adapters would present it.
- After completing the wizard, delete the data adapter and dataset from the report page and delete the corresponding dataset class from the project. All items created by the wizard are not needed anymore.
- On the report page, create a new typed dataset of the type that is used to get data from the DataAbstract server.
- Check the report properties and set the
DataSource
andDataMember
properties to point to the newly created dataset component and desired table in this dataset, respectively. - Make sure that all data bindings of all data aware report controls are set correctly. Edit data bindings if needed.
Note: The simplest way to edit data binding is to use the small button with the [>] sign shown above control when it is selected. Click it and a popup will appear, then use the Data Binding
drop-down box. The DataAdapter
report page property should be set to (none)
at this step.
- We need some way to fill the local dataset with remote data. Since the dataset component is private by default, we need to create a new method to fill it with data:
public void FillData(RemObjects.DataAbstract.DataAdapter dataAdapter)
{
dataAdapter.Fill(this.pdcTradeDataset1);
}
- The report page is done. Now we will use it from the main client form. Add a new button and set its OnClick event:
private void btnReport_Click(object sender, EventArgs e)
{
try
{
XtraReport1 report = new XtraReport1();
report.DataAdapter = this.remoteDataAdapter;
report.FillData(this.remoteDataAdapter);
report.ShowPreview();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "XtraReports sample", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
Note how the DataAdapter
property is set and how the remote data adapter is used to fill the report with data.
- Build and run the project. When you press the button added at step 7, the new report page will appear.