Integration of SSRS and .net using Iframe and URL Command Approach
Download JumpToSSRS.zip - 3.77 KB
Table of Contents
Introduction
The idea behind writing this technical paper is to bring the fact that we can tackle the problem of opening SSRS reports in web application without using report viewer webparts. There are lot many challenges when it comes to show custom SSRS reports with user defined .net search controls.
Using the below implementation approach we can very well able to render the SSRS rdl remote reports into MOSS portal without being using report viewer webpart.The approach is simple. The easy solution is to make use of IFrame concepts and page viewer webpart. The detailed implementation workaround will be thouroughly seen once go deep dive into this article.
Problem Statement
In real time business case we have scenarios where we need to provide custom reports to client and there we find limitations of SSRS reporting framework. It provide very limited search control unlike .net. In order to overcome this limitation the below implementation and idea can help to construct reports with most user friendly UI.
The concept is to call remote SSRS reports into .net using Report Command URL. Using this feature of SSRS we can expose SSRS meta data to .net environment. Moreover we can pass input parameter from .net to SSRS report using post form or Get Method. The again challenge is to embed SSRS report in .net without reportviewer control and this can be tackle using IFrame feature of HTML.
Prerequisites
The prerequisites the reader must be aware of the SSRS concepts and MOSS/sharepoint report viewer webpart. SQL Server 2005 SSRS ,MOSS 2007 and .net 2.0
Implementation Steps & Approach
Step 1: Create SSRS Report RDL file.
Create simple SSRS report using BIDS IDE. Add three text box into Layout sections. The idea is to showcase tradeoff between SSRS data coming from .net. This integration will help you to built around more complex solution based on this solution.
Create three hidden Report Parameter such as Report_Parameter_0,Report_Parameter_1 and Report_Parameter_2. Once these parameters are created ,add expression to each of the textbox mentioned above and assigned the value to these parameters respectively.
You can download the source code and can view exact implementations there.It is simple and easy to create.
Step 2: Upload RDL file into Report Manager
Upload RDL file into Report manager of SSRS reports folder. If the RDL is error free no issues uploading it into report manager Reports folder.
Note the URL of the report uploaded in Report manager. The URL would be something like this. Https://xx.com/reportserver/Reports/Demo
Step 3: Custom Input Fields In Asp.net
Now its time to write some .net code. The aim is to integrate .net and SSRS report. Here we are going to embed remote SSRS report into .net form without using Report viewer control.
The essential part of this implementation is to invoke or call server side code using Javascript. At runtime we construct form and post it through server side with hidden input field containing values to other website of SSRS report. There is mapping between hidden report parameter of RDL with respect to custom input control of ASP.net. This is how trade off between these two system is integrated using Post/Get method of ASP.net.
Below code snippet demonstrate the illustration given above. In the nutshell we have Report Command URL via which we can control many settings of reports such rendering,format,input fields and type of export of reports and all. SSRS Report Server URL Command:Using URL Access Parameters
protected void Button1_Click(object sender, EventArgs e) { first.Text = ConstructForm(TextBox1.Text, TextBox2.Text, TextBox3.Text); String strJS = PostFormThroughJS("form1"); second.Text = strJS; } private String PostFormThroughJS(String strFormId) { StringBuilder strScript = new StringBuilder(); strScript.Append("< script language="'javascript'">"); strScript.Append("var ctlForm = document.forms.namedItem('{0}');"); strScript.Append("ctlForm.target='Main';"); strScript.Append("ctlForm.submit();"); strScript.Append("< /script>"); return String.Format(strScript.ToString(), strFormId); } private String ConstructForm(String strRDLReportParameter0, String strRDLReportParameter1, string strRDLReportParameter2) { StringBuilder strForm = new StringBuilder(); strForm.Append("< form id=\"form1\" name=\"form1\" action=\"https://xxx/Reportserver?/yyy/Reports/Demo\" method="post">"); strForm.Append("< input type=\"hidden\" name=\"rs:Command\" value=\"Render\"<"); strForm.Append("< input type=\"hidden\" name=\"rs:Format\" value=\"HTML4.0\"<"); strForm.Append("< input type=\"hidden\" name=\"Report_Parameter_0\" value=\"{0}\"<"); strForm.Append("< input type=\"hidden\" name=\"Report_Parameter_1\" value=\"{1}\"<"); strForm.Append("< input type=\"hidden\" name=\"Report_Parameter_2\" value=\"{2}\"<"); strForm.Append("< /form >"); return String.Format(strForm.ToString(), strRDLReportParameter0, strRDLReportParameter1, strRDLReportParameter2); }
< html > <head runat="server"> <title>Custom Report:SSRS and .Net </title > </head> <body> <asp:Literal ID="first" runat="server"></asp:Literal> <asp:Literal ID="second" runat="server"></asp:Literal> <form id=form2 runat="server" target ="Main" > <asp:Label ID="Label1" runat="server" Text="Custom Report:SSRS and .Net Integration" Font-Bold="True" Font-Size="11pt"></asp:Label> <br /> <br /> <span style="font-size: 10pt"> Name</span> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <span style="font-size: 11pt">Location</span> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <span style="font-size: 11pt"> Skill</span> <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="View Report" /> <br /> <br /> <span style="font-size: 11pt">SSRS Report View</span> </form> <IFRAME ID="Main" name="Main" height=500px width=700px runat="server" /> </body> </html>
Step 4: [Optional] Integrate,Embed or Publish In Sharepoint/Moss
(I assume reader is known to sharepoint 2007.)Create asp.net solution and deployed the precompiled in Sharepoint Website under _Layout Virtual directory as sub site. Once the precompiled is deployed under subsite(YYY) of virtual directory of _Layout.
The URL in such case will be https://xxx.com/_layout/yyy/JumpToSSRS.aspx
Next step is to open sharepoint portal and administrator of the site will edit or add new page using site sittings.In the given page one needs to add Pageviewer webpart. In pageviewer webpart one needs to modify shared webaprts property and assign the .net relative path. _layout/yyy/JumpToSSRS.aspx. Once this settings are applied ,publish and checkin the page and it is available to access as per role-user mapping.
Summary
I tried to cover many important things in this article and below are key highlights of it.
Hope I tried to put things here more reasonably and most understandable way. Any suggestions or corrections are most welcome. Thanks
References
SSRS Report Server URL Command:Using URL Access Parameters HttpWebRequest Post Request To Another Web Site With Redirection
发表评论
Your site is very interesting, i have bookmarked it.
日本超人気スーパーコピーブランド時計激安通販専門店
2019年最高品質時計コピー、国際ブランド腕時計コピー、
業界唯一無二.世界一流の高品質ブランドコピー時計。73tm7V Really enjoyed this blog post.Really thank you! Awesome.
vNzgmV I truly appreciate this article post.Much thanks again. Really Great.
ブランド財布コピー
業内最高レベルのブランド財布コピー
世界ブランドコピー業内最高レベルのスーパーコピー品(N級品)をお客様に提供します。
ブランド財布コピー、ブランドキーケースコピー、
コピーブランド名刺入れ、
スーパーコピーレベルなど豊富な物件を揃いています。
ルイ・ヴィトンコピー
エルメス財布コピー
シャネルスーパーコピー
フェンディコピー
ミュウミュウコピー……
今、大セールが開催中…ブラウンは復古な味わいが溢れて、近年来は再度に流行になります。
バッグは女性の別の顔のように、女性の品位を顕現します。
今回登場したのは自信を溢れるシャネルバッグです。
ブラウンのバッグは素晴らしい効果があります。
★ 2017年シャネル経典的な逸品&最新美品
★ 2017新作の展示、新品種類がそろっています
★ 当社の商品は絶対の自信が御座います
★ 信用第一、良い品質、当店の承諾に→誠実 信用cZDpgP A big thank you for your post.Thanks Again. Want more.
95c0f9 Great, thanks for sharing this article post.Much thanks again. Great.
YHkbT1 Appreciate you sharing, great blog.Much thanks again. Awesome.
ew64Bb Very good blog post.Really thank you! Great.
This surely makes perfect sense to anyone!!!
That's very illuminating writing...
That was a frankly joy of a blog post..
I couldn't think you are more right.
Best piece..
What a really fun blog post...
Curiously, a well written article.
I do not disagree with you!!!
I do not disagree with this blog