On click action in SSRS 2005

Posted on 2007-10-08
Last Modified: 2012-06-27
Hi i am working on a report in SSRS 2005. i have a image in that report. Is it possible that i click that image and the background color of that perticular box changes(That image is placed on a rectangle). So that i know  that perticular image in that perticular row has been selected. Is this possible in SSRS? Please let me know if the question is not  clear
Question by:scvens
    LVL 16

    Expert Comment

    The question is clear, I would write a custom code routine to handle this, Custom code for use within your report using code embedded in the report.


    Author Comment

    Thanks  for replying. As this is on click action i was  not very sure if this could be possible.And i am new to SSRS and this is a bit complex code to write is there any way that u could help me  a bit more to finish my task.
    LVL 18

    Expert Comment

    The only method I can think of to do this without reloading the report would be to put a javascript:void() function as the URL destination on the navigation properties of the image.
    The problem with this is that you need an ID of the report object to do anything with it, and SSRS doesn't assign an ID to report objects. You can force it to assign an ID by making the control toggle the visibility of another control, but I can't even get it to work with this ID (not to mention the fact that you don't know the ID at design time)

    So, assuming that we can't do it using javascript, the only other way of doing it is to re-run the report every time you click on anything.
    i.e. add a hidden parameter to the report (SelectedID)
    When you first run the report, this will be null.
    Set the background color of the rectangle to an expression
       =IIF(Fields!ID.Value = Parameters!SelectedID.Value, "Red", "White")
    and the navigation of the image to point back to this same report, with the appropriate ID in the SelectedID parameter.

    Then, when you click something, the report will reload with that item highlighted in red.
    You can expand this to cope with multiple selections by making the parameter multi value.

    Hope this is some help
    LVL 18

    Accepted Solution

    I'm not sure if custom code can handle this - you would need some way of executing the custom code from the onclick - which I don't think you can do unless you rerun the report, in which case you don't need custom code as parameters will do it on their own.

    I'd be interested to be proven wrong about calling custom code from clicks - it would be a useful feature if it were possible...

    Author Comment

    Thanks for  replying this question alex.Actually the   main point here is i want to change the background color without refreshing the  report. Any w ay i appriciate the help alex and i am accepting this solution. I am also posting another question lpease have a look at it.
    LVL 18

    Expert Comment

    I won't post in the new question as I don't know of a solution to the problem - as far as I'm aware there is no solution without refreshing... sorry...

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
    Introduction In my previous article ( I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
    This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
    Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

    755 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

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now