locked
Do not have idea how to start RRS feed

  • Question

  • User-1249419835 posted

    Hi All,

           I am totally new to developing SSRS reports. I got some idea from different forums on creating SSRS reports but I am finding very difficult to call the same from asp.net. I am looking for a way to display list of reports from SSRS once I click on reports from client side asp.net.  This is the path I want get connected to once I select Reports in asp.net.

    http://servername/foler.aspx?ItemPath=%2fDriverData&ViewMode=List

    This is what I have tried

    <asp:Content ID="Content2" ContentPlaceHolderID="cphContent" Runat="Server">
        <rsweb:ReportViewer ID="MyReportViewer" runat="server" Font-Names="Verdana" 
            Font-Size="8pt" Height="400px" ProcessingMode="Remote" Width="400px">
            <ServerReport 
                ReportServerUrl="" />
        </rsweb:ReportViewer>

    My code behind:

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
            MyReportViewer.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Remote
            MyReportViewer.ServerReport.ReportServerUrl = New Uri("http://cvgutils01/Reports_PDIRPT")
            ' Report Server URL 
            MyReportViewer.ServerReport.ReportPath = "http://cvgutils01/Reports_PDIRPT/Pages/Report.aspx?ItemPath=%2fDriverData&ViewMode=List"
            ' Report Name 
            MyReportViewer.ShowParameterPrompts = False
            MyReportViewer.ShowPrintButton = True
    
           MyReportViewer.ServerReport.Refresh()
        End Sub

    I am not sure how to really set the path to list of all reports. I tried but neither gives me error nor displays the report. Please help me with this.

    Thanks!

    Friday, March 16, 2012 1:03 PM

All replies

  • User306743125 posted

    Hi

    How about this?
    Create a GridView which get its data from the Catalog table in the Reporting Services DataBase.
    This will list all the available reports, add a select to the GridView. If selected, pass the reportname to the ReportViewer.
    You could filter your report selection to only display reports in ceertian folders, on your reportserver, if you do not what to give the external user access to all reports.

    Binding the GridView: (gridview.aspx.cs)

        protected void loadReportGrid()
        {
            SqlConnection conn = null;
            try
            {
                string connStr = ConfigurationManager.ConnectionStrings["ReportServerConnectionString"].ConnectionString;
                string query = "SELECT Name as ReportName, Path as ReportPath, Description FROM Catalog  WHERE Path LIKE '%AspFolder/Some Reports%' AND Type<>1";
    
                conn = new SqlConnection(connStr);
                SqlCommand cmd = new SqlCommand(query, conn);
                SqlDataReader reader;
    
                conn.Open();
    
                cmd.CommandType = CommandType.Text;
                reader = cmd.ExecuteReader();
                GridView1.DataSource = reader;
                GridView1.DataBind();
            }
    
            catch (Exception ex)
            {
    
                Console.WriteLine(ex.ToString());
            }
    
    
            finally
            {
                conn.Close();
            }
        }
    Add the "Select" option to the GridView: (gridview.aspx)
                <asp:TemplateField HeaderText="Selection" HeaderStyle-HorizontalAlign="Center"> 
                <ItemTemplate > 
                    <asp:HyperLink ID="lnkSelect" runat='server' ItemStyle-CssClass="gvColumns" NavigateUrl='<%# String.Format("ReportViewer.aspx?ReportPath={0}", Eval("ReportPath")) %>'>Select</asp:HyperLink> 
                </ItemTemplate>
                </asp:TemplateField> 
    Load the selected report: (reportviewer.aspx.cs)
    
    
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string Report = Request.QueryString["ReportPath"];
                ReportViewer1.ServerReport.ReportPath = Report;
                this.ReportViewer1.DataBind();
                string UserIdValue = Profile.RefKey;
                this.ReportViewer1.ServerReport.Refresh();
            }
        }
    Saturday, March 17, 2012 3:00 AM
  • User-1249419835 posted

    Thank you very much for your reponse. But my manager is so particular, he does not want me to complicate things. I think he is basically sql server guy and would like to call a iframe and execute everything from sql server. So this is what I did.

     

    <%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="Reports.aspx.vb" inherits="Reports"%>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="cphhead" Runat="Server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="cphContent" Runat="Server">
    
    <iframe src="http://cvgutils01/Reports_PDIRPT/Pages/Folder.aspx?ItemPath=%2fDriverData&ViewMode=List"  height ="500" width = "80%" frameborder ="0"></iframe>
    
    </asp:Content>
     
    The problem with this is that while running it locally from Visual studio,  I get "Microsoft JScript runtime error: Unable to set value of the property 'className':
     object is null or undefined" error from ReportingServices.js file. I really do not have any idea from where VS2008 is executing this file. 
     
    It works fine, if I include the above code in reports.aspx file on the server after I published it. So there is something happening running locally and running after publishing it. 
     
    Can you or anyone help me with this? I am totally new to SSRS reports as well as asp.net. This is my first project. Please let me know if you need more info.
     
    Thanks in advance
     
     
     
     
    Monday, March 19, 2012 8:37 AM
  • User306743125 posted
    You can't do it's through an iframe...this is what the reportviewer is for. There is nothing complicated about.
    Monday, March 19, 2012 1:20 PM