Display the User Name in a Report
This tutorial demonstrates how to insert the current user name in a report using the XRPageInfo control.
Do the following to insert the user name into a report:
- To create a table report in this tutorial, start with a report that is bound to the “Products” table of the sample Northwind database. To learn more about binding a report to a data source, see Provide Data to Reports.
In the Visual Studio Report Designer, switch to the Field List, select the ProductName and UnitPrice fields, and drag-and-drop them onto the report’s Detail band.
Typically, the user name is displayed within the ReportHeaderBand. To add it to the report, right click anywhere on the report’s surface. In the invoked menu, point to Insert Band and click ReportHeader.
Drop the XRPageInfo control from the DX.24.1: Report Controls Toolbox tab onto the ReportHeader band.
Set the control’s XRPageInfo.PageInfo property to UserName (e.g. using its smart tag).
Next, to apply a format string to the control’s contents, type Current User: {0} into its
Format
property.