Since my Access days, I've believed in renaming important* controls in reports. Now that I use Reporting Services daily, this practice still holds: ambiguous names like "Textbox1" or "Textbox112" become "ReportName" or "FinalBalance", "table1" becomes "WidgetSalesTable", and "chart1" becomes "MonthlyTrendChart".
As well as better organising the report while in development and adding only a small amount of time to actually do, renaming controls is useful to me later when I'm maintaining a report as I can see which controls contain which data points.
There's one further advantage to renaming controls in a Reporting Services report: because reports are stored in XML format, I can extract the static contents of a control (as long as I know it's name) either from the RDL file or from the RDL file stored as XML in the
Catalog table in the
I recently needed this functionality as I wanted a list of reports with the contents of a textbox on each report body called "Purpose".
This was fairly straightforward to accomplish using the XML
nodes() method, which is dependent on the control being sought (which is why there's no code for this blog post, sorry!)
* I don't usually rename controls that contain "meta" information, like column headers and blank cells.
Tags: sql server, reporting services