Tuesday, August 9, 2011

SQL Server Report With Asp.net Application

This article features integration of SQL Server Report With Asp.net Application. To call SQL Server Reports With Asp.net Application from front end can be acheived in few steps as under. 
Solution 1 : Direct Load Report in Application.
  1. Create a new website.
  2. Add the report viewer to a form.
  3. Change the ProcessingMode to Remote.
  4. Also change the AsyncRendering to FALSE.
  5. Then assign two properites to the report viewer:
    • ReportViewer1.ServerReport.ReportServerUrl 
    • ReportViewer1.ServerReport.ReportPath 
Report should then pop up in your page.

Solution 2 : Load the report on click of the menus on a web page.

  1. Click the smart tag which is located on the top left corner or the ReportViewer to show the ReportViewer Tasks panel.
  2. In the Choose Report dropdown list, select to display report on the Report Server.
  3. Type in the Report Server Url in the Report Server Url textbox like Exe:-http://servername/reportserver.
  4. Keep the Report Path textbox blank.
  5. In the click event handler of the menu, type in the code below to specify the report dynamically:
    • ReportViewer1.ServerReport.ReportPath ="/FolderName/ReportName"; 
    • ReportViewer1.ServerReport.Refresh();
 After that, the ReportViewer would not display report until click the menu.