Welcome to Spipp.net server Sign in | Join | Help

Kaisa's blog

On Reporting Services, Sharepoint, dotText and Larp

Replacing the page title in Report Manager

Someone called Vivian / Vyv posted to the Reporting Services news group on how to replace the tekst in the page title of reporting services reports. By default, the page title is "Report Manager"". Not very descriptive, so she had made a good point. ANd someone called Stas K / Sorcerdon came up with a solution. I modified Sorcerdon's original code with a replace function that replaces +s with a space, so the resulting title is "My Report Name" instead of "My+Report+Name". The result looks really neat.

The trick is to add the following code bevore the .net tags in Report.aspx, found in C:\Program Files\Microsoft SQL Server\MSSQL\Reporting Services\ReportManager\Pages.

<script>
// function getQueryVariable and page script found at
// http://groups.google.com/group/microsoft.public.sqlserver.reportingsvcs/browse_thread/thread/39e5747688f51268/d0a6a49f6891dfd4
// function replace found at
//http://www.rgagnon.com/jsdetails/js-0043.html
//Purpose of code: Replace Report Manager with the report name in Report Manager

function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {

return pair[1];
}
}
//alert('Query Variable ' + variable + ' not found');
}

function replace(s, t, u) {
/*
** Replace a token in a string
** s string to be processed
** t token to be found and removed
** u token to be inserted
** returns new String
*/
i = s.indexOf(t);
r = "";
if (i == -1) return s;
r += s.substring(0,i) + u;
if ( i + t.length < s.length)
r += replace(s.substring(i + t.length, s.length), t, u);
return r;
}

</script>

<script>
var query2 = getQueryVariable("ItemPath")
query2 = query2.substring(query2.lastIndexOf('%2f')+3,query2.length);
query2 = replace(query2, '+', ' ');
document.title =query2
</script>

Published 10-04-2006 10:02 by kaisa
Filed Under:
New Comments to this post are disabled
SkinName:iroha_Blog2
Powered by Community Server, by Telligent Systems