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.
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.
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)
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.
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.
ylsv
Member
116 Points
86 Posts
Do not have idea how to start
Mar 16, 2012 05:03 PM|LINK
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 SubI 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!
Basquiat
Contributor
2382 Points
634 Posts
Re: Do not have idea how to start
Mar 17, 2012 07:00 AM|LINK
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(); } }<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>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(); } }ylsv
Member
116 Points
86 Posts
Re: Do not have idea how to start
Mar 19, 2012 12:37 PM|LINK
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.
Basquiat
Contributor
2382 Points
634 Posts
Re: Do not have idea how to start
Mar 19, 2012 05:20 PM|LINK