The Textbox is the most commonly used report control that displays data. By default, the TextBox appears in each cell of a Table or Tablix data region. Also, the TextBox is what is created when you drag a field from the Data Explorer onto the report.
In the Value property of the TextBox, you can enter static text or an expression. An expression can display fields from a database, calculate a value, or visually display data.
In the Properties Window are a number of properties that you can use to control the appearance and behavior of the TextBox. For example, you can set the Action property to have the viewer jump to a bookmark within the report, another report, or a URL when a user clicks the TextBox at run time. The DataElement properties allow you to control how and whether the TextBox displays in XML exports.
By default, in RDL Reports, the TextBox can grow vertically to accommodate the data it displays, and it cannot shrink smaller than it appears at design time. To change this behavior, set the CanShrink and CanGrow properties in the Properties grid. (These properties are not available in Page Reports.)
When you drag a field from a dataset in the Data Explorer and drop it onto the report surface, a TextBox report control with an expression is automatically created. The type of expression that is created depends upon the context where you drop the field. The following table describes the various contexts and expressions created if you drag a field named SalesAmount onto the report.
Expressions created for fields in different contexts
Context | Expression | Run-Time Behavior |
---|---|---|
Directly on the report surface | =Sum(Fields!SalesAmount.Value) | Displays a summary of the sales amount for the entire dataset. |
List data region | =Fields!SalesAmount.Value | Displays a value for each row of data, in a list running down the page. |
BandedList data region, header or footer band | =Sum(Fields!SalesAmount.Value) | Displays a summary of the sales amount for the dataset associated with the BandedList. |
BandedList data region, detail band | =Fields!SalesAmount.Value | Displays a value for each row of data, in a list running down the page. |
BandedList data region, group header or footer band | =Sum(Fields!SalesAmount.Value) | Displays a summary of the sales amount for the grouping. |
Table data region, header or footer row | =Sum(Fields!SalesAmount.Value) | Displays a summary of the sales amount for the dataset associated with the Table. |
Table data region, detail row | =Fields!SalesAmount.Value | Displays a value for each row of data, in a list running down the page. |
Table data region, group header or footer row | =Sum(Fields!SalesAmount.Value) | Displays a summary of the sales amount for the grouping. |
Tablix data region, corner cell | none | Displays a blank cell. You can add a label or even use this area to embed other report control. |
Tablix data region, column group cell | =Fields!SalesAmount.Value | Displays the value at the top of a new column for each row of data running to the right. |
Tablix data region, row group cell | =Fields!SalesAmount.Value | Displays the value to the left of a new row for each row of data running down the page. |
Tablix data region, body cell | =Sum(Fields!SalesAmount.Value) | Displays a summary of the sales amount for the intersection of the column and row. |
Properties for the Textbox are available in the Textbox dialog. To open it, with the Textbox control selected on the report, under the Properties Window, click the Property dialog link.
The Textbox dialog lets you set properties on the report control with the following pages.
Note: You can select <Expression...> within many of these properties to open the Expression Editor. You can also access the Expression Editor from the context menu of the TextBox control.
General
Name: Enter a name for the textbox that is unique within the report. This name is displayed in the Document Outline and in XML exports. You can only use underscore (_) as a special character in the Name field. Other special characters such as period (.), space ( ), forward slash (/), back slash (\), exclamation (!), and hyphen (-) are not supported.
Tooltip: Enter the value or expression you want to appear when a user hovers the cursor over the textbox in the viewer at run time.
Note: You must select Print Preview mode in order to see this property working in the viewer.
Value: Enter an expression or a static label, or choose a field expression from the drop-down list.
Note: When the group or dataset breaks to a new page, the first instance of the repeated value is printed.
Visibility
Initial visibility allows you to select from the following options:
Visibility can be toggled by another report control: If you select this check box, it enables the drop-down box where you can specify the TextBox control that users can click to toggle the visibility of the textbox.
Initial appearance of the toggle image: allows you to select from the following options:
Navigation
Select one of the following actions to perform when a user clicks on the textbox.
None: The default behavior is to do nothing when a user clicks the textbox at run time.
Jump to report: For drill-through reporting, select this option and provide the name of a local report, the relative path of a report in another folder, or the full path of a report on another server. You can also use expressions to create drill-through links.
Parameters: Supply parameters to the targeted report by entering the Name of each parameter, the Value to send to the targeted report, or whether to Omit the parameter. Note that parameter names you supply must exactly match parameters in the target report. You can remove or change the order of parameters using the X and arrow buttons.
Jump to bookmark: Select this option and provide a valid Bookmark ID to allow the user to jump to the report control with that Bookmark ID.
Jump to URL: Select this option and provide a valid URL to create a hyperlink to a Web page.
Document map label: Enter an expression to use as a label to represent this item in the table of contents (document map).
Bookmark ID: Enter an expression to use as a locator for this textbox. You will then be able to provide a bookmark link to this item from another report control using a Jump to bookmark action.
Appearance
Style: Select a style for the border.
Width: Enter a value in points to set the width of the border.
Color: Select a color to use for the border, or select the <Expression...> option to open the Expression Editor and create an expression that evaluates to a .NET color.
Color: Select a color to use for the background of the textbox.
Image: Enter an image to use for the background of the textbox.
Font
Family: Select a font family name or a theme font.
Size: Choose the size in points for the font or use a theme.
Style: Choose Normal or Italic or select a theme.
Weight: Choose from Lighter, Thin, ExtraLight, Light, Normal, Medium, SemiBold, Bold, ExtraBold, Heavy, or Bolder.
Color: Choose a color to use for the text.
Decoration: Choose from None, Underline, Overline, or LineThrough.
Format
Format code: Select one of the common numeric formats provided or use a custom .NET formatting code to format dates or numbers. For more information, see MSDN's Formatting Types topic.
Line Spacing: This property sets the space between lines of text.
Line Height: This property sets the height of lines of text with leading and ascending space.
Character Spacing: This property sets the space between characters.
Can increase to accommodate contents: Select this check box to set CanGrow to True.
Can decrease to accommodate contents: Select this check box to set CanShrink to True.
Can shrink text to fit fixed size control: Select this check box to set ShrinkToFit to True.
Direction: Choose LTR for left to right, or RTL for right to left.
Mode: Choose lr-tb for left right top bottom (normal horizontal text) or tb-rl for top bottom right left (vertical text on its side).
Angle: Enter the number of degrees to rotate the text in a counter-clockwise direction. Enter a negative number to rotate the text in a clockwise direction.
Alignment
Vertical alignment: Choose Top, Middle, Bottom, or the <Expression...> option.
Horizontal alignment: Choose General, Left, Center, Right, Justify, or the <Expression...> option.
Justify method: Set Horizontal alignment to Justify to enable this property. Choose Auto, Distribute, DistributeAllLines, or the <Expression...> option.
Wrap mode: Choose NoWrap, WordWrap, or CharWrap.
Amount of space to leave around report control
Interactive Sort
Select the checkbox next to Add an interactive sort action to this textbox to enable the following controls which allow end users to sort the report data in the viewer.
Sort expression: Enter an expression to use for determining the data to sort.
Data region or group to sort: Select the grouping level or data region within the report to sort. The default value is Current scope, but you may also elect to choose an alternate data region or grouping.
Evaluate sort expression in this scope: Select the grouping level within the report on which to evaluate an aggregate sorting expression. The default value is Current scope, but you may also elect to choose an alternate data region or grouping.
Data Output
Element Name: Enter a name to be used in the XML output for this textbox.
Output: Choose Auto, Yes, or No to decide whether to include this textbox in the XML output. Auto exports the contents of the textbox only when the value is not a constant.
Render as: Choose Auto, Element, or Attribute to decide whether to render textboxes as Attributes or Elements in the exported XML file. Auto uses the report's setting for this property.
Attribute example: <table1 textbox3="Report created on: 7/26/2005 1:13:00 PM">
Element example: <table1> <textbox3>Report created on: 7/26/2005 1:13:28 PM</textbox3>