BookmarkId in URL
I need to adda bookmark to the URL so when the new report is displayed, it automatically goes to the bookmarked section. I put the BookmarkID in the URL and it still doesn't work. Here's the URL:
http://dev5/ReportServer/Pages/ReportViewer.aspx?/LHD2.0/TPIDDetail&TPID=2199596&Avg=58&rs:Command=Render&rc:BookmarkID=Test
June 29th, 2009 9:07pm
Hi L.M,
From your description, you want the report go to a bookmark automatically using URL Access. If I have misunderstood, please do not hesitate to let me know.
By designer, going to specify bookmark based on the parameter BookMarkID of URL Access is invalid.
However, the reporting services use the JavaScript to go to bookmark. We can improve custom JavaScript function to go to bookmark on report rendering.
The default actionhandle for going to bookmark is like this:
ClientReport0eb32b4586904d949d6b34617f030ed3.ActionHandler('Bookmark','BMID');
Here are the detailed steps of the workaround for your reference:
1. Embed custom code in the report:
Public Shared Function GetColor()
Dim script as String
script = "var url=parent.parent.window.location.search;var Request = new Object(); if(url.indexOf(""?"")!=-1){var str = url.substr(1); strs = str.split(""&"");for(var i=0;i<strs.length;i++) { Request[strs[i].split(""="")[0]]=unescape(strs[i].split(""="")[1]);} } ;"
script = script + "function GetOnloadEvent(){ if(Request[""rc:BookmarkID""]){var cellObject = document.getElementById(""oReportCell"");if(cellObject ){"
script = script + "var ClientReport = new RSReport(parent.parent.document.getElementById('ReportViewerControl').ClientController, '', 'oReportDiv', 'oReportCell', '100', '', 1, 1, false, 0, '', 0, '');"
script = script + "ClientReport.ActionHandler('Bookmark',Request[""rc:BookmarkID""]);"
script = script + "clearTimeour(timer);}else{setTimeout(GetOnloadEvent,50);}}}var timer;timer=setTimeout(GetOnloadEvent,50);"
System.Web.HttpContext.Current.Response.Write("<script language='javascript'>" & script & "</script>")
Return "Transparent"
End Function
The code will register a client script. The script is used to go to bookmark.
a. Get the URL.
b. If the URL does not contain the parameter BookMarkID, render the report.
c. If the URL contains the parameter BookMarkID:
d. Create the ClientReport object.
e. Execute the going to bookmark action ClientReport.ActionHandler('Bookmark',Request[""rc:BookmarkID""]);
2. In Report Designer, go to Layout page, set the color property of the body to be: =Code. GetColor()
3. Click the menu Report - Report Properties Reference.Add a reference System.Web
4. Configure the code access for the Report Server.
5. Now, if passing the parameter BookMarkId in the URL, the report will go the bookmark automatically.
For more information, please see:
Understanding Code Access Security in Reporting Services: http://msdn.microsoft.com/en-us/library/ms155108(SQL.90).aspx
If there is anything unclear, please feel free to ask.
Thanks,
Jin Chen
Free Windows Admin Tool Kit Click here and download it now
July 1st, 2009 10:54am
Hi J.C. I try your solution but I don't works on my report server ... I have few questions ? 1) is URL Access by Bookmarkid invalid in RS 2005 or RS 2008 ? 2) I have already " Configure the code access for the Report Server " for a custom assembly for a data extension and it works fine (with a lot of try). but this dll was a classic dll (not strong named). In your solution, it's a bit different : system.web.dll is strong named ! I put this in rssrvpolicy.config
<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="system.web"
Description="xxx">
<IMembershipCondition
class="StrongNameMembershipCondition"
version="1"
PublicKeyBlob="002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293"
/>
</CodeGroup>
is this correct ? i get this error message in rs log
w3wp!session!1!06/08/2009-10:29:36:: i INFO: LoadSnapshot: Item with session: t45nymbvgrdaz055lhv3r3yf, reportPath: , userName: INETPSA\U212693 not found in the database
w3wp!library!1!06/08/2009-10:29:36:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ExecutionNotFoundException: L'excution t45nymbvgrdaz055lhv3r3yf est introuvable., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.ExecutionNotFoundException: L'excution t45nymbvgrdaz055lhv3r3yf est introuvable.
w3wp!session!5!06/08/2009-10:29:37:: i INFO: LoadSnapshot: Item with session: t45nymbvgrdaz055lhv3r3yf, reportPath: , userName: INETPSA\U212693 not found in the database
w3wp!library!5!06/08/2009-10:29:37:: e ERROR: Throwing Microsoft.ReportingServices.Diagnostics.Utilities.ExecutionNotFoundException: L'excution t45nymbvgrdaz055lhv3r3yf est introuvable., ;
Info: Microsoft.ReportingServices.Diagnostics.Utilities.ExecutionNotFoundException: L'excution t45nymbvgrdaz055lhv3r3yf est introuvable.
w3wp!library!1!06/08/2009-10:29:37:: Unhandled exception was caught: Microsoft.Reporting.WebForms.ReportServerException: L'excution t45nymbvgrdaz055lhv3r3yf est introuvable. (rsExecutionNotFound)
Microsoft.Reporting.WebForms.ServerReport.GetExecutionInfo()
Microsoft.Reporting.WebForms.ServerReport.SetExecutionId(String executionId, Boolean fullReportLoad)
Microsoft.Reporting.WebForms.ReportDataOperation..ctor()
Microsoft.Reporting.WebForms.HttpHandler.GetHandler(String operationType)
Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context)
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
3) does your solution works in RS2005 with Snapshot Reports which are scheduled? Thank for your replySylvain Le Strat
August 6th, 2009 5:46pm
Hi Jin,
Where is the bookmark in the report set? How does the URL Link know where to go? I'm not sure I understand why we are setting the Color field to transparent?
Free Windows Admin Tool Kit Click here and download it now
May 28th, 2010 8:21pm
Did this javascript work inside SSRS 2005?Mr Shaw
November 23rd, 2010 2:17am
I try use this example. But it gives a lot of problems. some of them I fixed, some find reason but main problem “go to bookmarked” in SharePoint
mode still open.
I searching for solution “go to” on load about week but couldn’t find any solution for me. What I could find, maybe someone will be useful
it.
1.
Access to Reference. Fixed. Configure the code access for the Report Server – fixed by open “FullTrust”
2.
.config
in part “Description="This
code group grants MyComputer code Execution permission. ">”
3.
Custom Code. Find reason. I found that “System.Web.HttpContext.Current.Response.Write("<script
language='javascript'>" & script & "</script>")” works!! But it works only if you render your report by
ReportViewer.aspx (by reportserver) and
RSViewerPage.aspx (SharePoint server) is not works. In RSViewerPage its show “remote error”. When turn on “remoteerror” in ReportServer, error message is “MemoryStream length must be non-negative and less than…”.
This error show if you try call .Web.HttpContext.Current.Response.Write("<anycode>”).
Strange when you call empty
Web.HttpContext.Current.Response.Write("”)
It work without error.
I don’t try work Custom Code that was post. But I try simpy my own code that goto some bookmark onload report BUT ONLY IN reportviewer.aspx. and its not solution for me.
I still searching for GoTo Bookmark OnLoad in SharePoint server. So if someone found solution
could you inform all other
Free Windows Admin Tool Kit Click here and download it now
September 2nd, 2011 7:57am