locked
How to call ssrs report using report viewer in from c# RRS feed

  • Question

  • User1267402261 posted

    Hello,         I created a new ssrs report and need to call this report from aspx page.

    before that we have active reports when I click on btnprintpdf and btnprintexcel this will call active reports and generate the report;now currently no more active reports they are not working.so we created new ssrs report how can I call this from aspx page? We have a table called reportexporttype and this will take care how to export this in pdf or excel based on id's.

    This is the url http://devpps02/ReportServer/ReportExecution2005.asmx This is the path /FinWeb/SN/Reports/EligibilityInformation  

    This is my aspx page

    <%@ Control Language="c#" AutoEventWireup="True" Codebehind="DirectPG.ascx.cs" Inherits="GADOE.SN.Web.PageControl.DirectPG" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%> <%@ Register TagPrefix="igsch" Namespace="Infragistics.WebUI.WebSchedule" Assembly="Infragistics2.WebUI.WebDateChooser.v7.2" %> <%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls" %> <asp:panel id="SearchPanel" Width="100%" Runat="server">  <TABLE id="Table1" cellSpacing="0" cellPadding="3" width="100%" border="0">   <TR>    <TH class="tblHead">     Direct</TH></TR>

    <TR>    <TD style="WIDTH: 100%" align="right" bgColor="#eeeeee">         <asp:Button id="btnPrintPDF" runat="server" Font-Bold="True" BorderColor="LightGray" Text="Print PDF"      BorderStyle="Ridge" BackColor="#EEEEEE" onclick="Page_Event"></asp:Button>     <asp:Button id="btnXLS" runat="server" Font-Bold="True" BorderColor="LightGray" Text="Export to XLS"      BorderStyle="Ridge" BackColor="#EEEEEE" onclick="Page_Event"></asp:Button></TD>    </TABLE> </asp:panel>

    and this is my code behind file

     public void ProcessRequest(object sender, object eventtype)   {    string controlName=null;    try    {     controlName=((System.Web.UI.WebControls.Button)eventtype).ID;     switch(controlName)     {            case "btnPrintPDF":  break;      case "btnXLS": break; } }             catch (BaseException ex)    {     if (ex.Message != "Thread was being aborted.")      ExceptionManager.AppendException(ex, System.Web.HttpContext.Current);    }    catch(Exception cEx)    {     if (cEx.Message != "Thread was being aborted.")      ExceptionManager.AppendException(new ControlException(702, "Error in DirectCTL:ProcessRequest", cEx), System.Web.HttpContext.Current, true);    }   }

    Please help me..                 

    Monday, March 3, 2014 8:39 PM

Answers

  • User1140095199 posted

    Hi,

    Are you using ReportViewer Control?  It allows you to Export Reports in various formats and printing. Drag and Drop ReportViewer control from the toolbox in Visual Studio.

    Here is the Source Code:

        <div>
            <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
                <LocalReport ReportPath="ReportDemos\Report.rdlc">
                    <DataSources>
                        <rsweb:ReportDataSource DataSourceId="SqlDataSource1" Name="DataSet1" />
                    </DataSources>
                </LocalReport>
            </rsweb:ReportViewer>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [MyData]"></asp:SqlDataSource>
        </div>

    It supports both Remote processing Mode and Local Report Mode.
    Using the WebForms ReportViewer Control - http://technet.microsoft.com/en-us/library/aa337091.aspx

    Creating an ASP.NET report using Visual Studio 2010 - Part 1 - http://weblogs.asp.net/rajbk/archive/2010/05/09/creating-an-asp-net-report-using-visual-studio-2010-part-1.aspx

    Best Regards!

     

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, March 4, 2014 10:26 PM