Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I call the function when the SSRS page loads.

Posted on 2010-11-19
5
Medium Priority
?
2,044 Views
Last Modified: 2012-05-10
I have written an some embeded function code.

How do I call the function when the SSRS page loads.

Thanks.
0
Comment
Question by:Mr_Shaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 10

Expert Comment

by:itcouple
ID: 34171452
Hi

You can use functons with expressions like that
=Code.FunctionName()

Let me know if that answers your question.
Regards
Emil
0
 

Author Comment

by:Mr_Shaw
ID: 34171478
I am now getting the following error.

[rsRuntimeErrorInExpression] The Value expression for the textbox ‘textbox1’ contains an error: Object reference not set to an instance of an object.
Preview complete -- 0 errors, 1 warnings

Here is my code

Public Shared Function Test() As String
System.Web.HttpContext.Current.Response.Redirect("www.web.address")
End Function



0
 
LVL 10

Accepted Solution

by:
itcouple earned 2000 total points
ID: 34171564
Hi

I have seen and tried to use System.Web.HttpContext. in the past but no luck. I think I have seen it working to center image on SSRS report but this was used by using assemblies and classes and i have tried that to do Javascript injection (and even with injection you still have to preess button on report).

In your case you try to use function which should only return singular value and you try to perform actions and that potentially may be blocked or not have access to it. The way I know this can be used is assemblies with classes alghough I only know examples where only certain parts of the report are manipulated not to redirect.

Where did you find this code? Did it relate to ssrs?

If you really want going this way just build asp.net page and use ReportViewer it was built for this purpose and is much more flexible. If you go this way you can also 'grab' the report and use Javascript I did that (proof-of-concept') to get very nice tooltips :)

Hope that answers your question.
Emil

0
 

Author Comment

by:Mr_Shaw
ID: 34171708
So i take it the following would also not work

Public Shared Function AddJavaScriptFile()
  System.Web.HttpContext.Current.Response.Write("<script type='text/javascript'><!--window.location = 'http://www.google.com/'//--></script>")
 return nothing
 
End Function
0
 
LVL 10

Expert Comment

by:itcouple
ID: 34171951
You would have to do Javascript incjection by default any Javascript code is removed (unless it is used as a hyperlink on the report, the exception I know)

Here is something which helped with incjection
http://blogs.infosupport.com/blogs/bast/archive/2009/09/10/reporting-services-javascript-injection.aspx

You can find my sample code there in comments (as Emil)
Regards
Emil
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, I have heard from my friends that it’s not possible to create Label Printing report using SSRS. I am amazed after hearing this words not possible in SSRS. I googled lot and found that it is possible to some of people know about the Report Bui…
A recent question popped up and the discussion heated up regarding updating a COMMENTS (TXT) field in a table using SSRS. http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/MS-SQL_Reporting/Q_27475269.html?cid=1572#a37227028 (htt…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question