Below are some tips in SSRS:
1. ToDisplay Top N rows in report using Tablix control
Create a parameter with IntegerDataType and select Default values from Properties, under specific values addexpression number of rows you want to display (i.e cint(10)). Now right clickon Tablix control and select properties, select Filters and add new filter
Value= =Parameters!TopN.Value as expression.
Now in Report it will display Top N rows.
2. To GetTotal Pages and Page Number for each Page in Report Footer
Add Textbox and assign the below expression to display total pages and pagenumber in Footer of report
="Page "+ Globals!PageNumber.ToString() +" of"+Globals!TotalPages.ToString()
3. Viewing SSRS reports using ReportViewer
Add below sample code to view report whichdeployed in server:
ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://computername:8080");
ReportViewer1.ServerReport.ReportPath = @"/Examples/Sample";
ReportViewer1.ProcessingMode = ProcessingMode.Remote;
ReportServerCredentials _ReportCredentials = new ReportServerCredentials("windowsuserid","password");
ReportViewer1.ServerReport.ReportServerCredentials = _ReportCredentials;
ReportViewer1.AsyncRendering = false;
ReportViewer1.SizeToReportContent = true;
4. Adding Fontstyles in Run Time to Tablix controls or Textboxes in SSRS Reports
Select Report from menu and select code from the menu add following code toadd font styles to controls in run time. I have report and want to add fontstyles of Report Heading in run time
Public Function GetColor(ByVal Section as String) as String
IF Section ="Report Heading" Then
Public Function GetSize(ByVal Section as string) as String
IF Section = "ReportHeading" Then
Public Function GetFont(ByVal Section as string) as String
In Report Header I have added Textbox to display the Report heading and addstyles in Run time.
Now right click on Textbox and select properties, under Font add following expressionto add styles in run time.
In Font ==Code.GetFont(“ReportHeading”) as expression
Size==Code.GetSize(“ReportHeading”) as expression
Color== Code.GetColor(“ReportHeading”) as expression
5. To Hide/Show Textboxes,Tablix controls in Runtime
If there is no data to display in Tablix, then I don’t want to displayTablix control in report.
Right click on Tablix control and select Visibility and add below expressionunder show or hide based on an expression.
This will hide tablix if data is not present, otherwise itwill display the table with data.
6. To addalternative row colors in Tablix control
Right click on details group of Tablix control, under backgroundColor addbelow expression
=iif(RowNumber("DataSet") mod2 = 0,"Steelblue",”White”)
7. FormattingDateTime in Report parameters
Revision number 1, Thursday, May 06, 2010 9:08:40 PM by email@example.com
You must Login to comment.
Mon, Feb 4, 2008 8:00 AM
SQL Server Security
There's a lot of great information on SQL Server Security covering both SQL Server 2000 and 2005. Blogs/DevCenters SQL Server 2005 Security on Microsoft.com - Start here. SqlSecurity.com - Good security focused blog 10 Steps To Help Secure SQL Server 2000
Mon, Jun 1, 2009 6:33 AM
Overview The Report Viewer control allows web application developers to leverage full-featured reports and present them to the user in an easy to use and intuitive interface. The Report Viewer 2008 ships as a part of Visual Studio, along with the integrated