This is a migrated thread and some comments may be shown as answers.

Silverlight - Can a button be added to report detail?

4 Answers 28 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Kenneth
Top achievements
Rank 2
Iron
Kenneth asked on 19 Apr 2014, 12:17 AM
Silverlight, VS 2010, VB.NET

I would like to add a button or clickable image that will raise an event in my code behind.

In my report I display, for example, a list of clients.  when the user clicks the 'open' button or image I want to launch a user control that displays the client entry screen.

Is this possible?

4 Answers, 1 is accepted

Sort by
0
Kenneth
Top achievements
Rank 2
Iron
answered on 22 Apr 2014, 11:50 PM
This is either not possible or perhaps I explained it poorly.

I would like to treat the report like a datagrid and have in one of the cells a button.  When the user clicks the button my code would perform some action with the record associated with the current row. I realize this is not something normally done with reports in general but it is often done with datagrids.  Since my reports give a lot of filtering and search options to the user I thought it would be a nice feature to be able to 'manipulate' the records shown in the report.  Of course this would only be meaningful for reports that had a simple one-to-one relationship to the underlying data, like a simple datagrid view of a table.

It would be easy for me to display the data in a datagrid with buttons using the same data object that populates the report, in fact that's what I had before I converted to telerik reporting, but then I would need a 'preview' mode (the datagrid) and a 'print'  mode (the reportviewer).
0
Squall
Top achievements
Rank 1
answered on 23 Apr 2014, 02:15 PM
You can add a NavigateToReport action that targets the same report with report parameter value to identify the row. Then within the Report.ItemDataBinding you can check the processing report parameter for a valid row value and execute the required code against your data.
0
Kenneth
Top achievements
Rank 2
Iron
answered on 24 Apr 2014, 07:49 PM
Very clever, and it almost worked. I added an navigate to action that opens the same report type and I passed it a parameter called rowID that was the ID of the current record.  In the report itemDataBound event I inspected the parameter and if it was not -1 (the default value) then I knew it was a rowID.  Here is where a few problems arose.

The main problem is that the event is being trapped in the report class of the report library project which is a class library not a silverlight project, so I cannot reference any silverlight code from here.  If  mine was strictly an ASP.NET project then a action that opens a url in a new window would probably work just fine for what I'm trying to do.

Another issue is that by navigating to a report (even the same report) adds a history to the report viewer, ideally I would cancel the 'new' report once I gained control in the event to prevent that.  Aside from the history being unnecessary and wasting resources the user could then click the back and forward buttons on the viewer and the same rowID parameter is passed  as when the report was originally created.

I've come to the conclusion that since the report is actually created on the server there is no way for the client side to interact with it as I wanted.  However, with the navigate to url capability it would be possible to create a silverlight page to be the target of such a request but that does not exactly provide what I wanted.







0
Stef
Telerik team
answered on 29 Apr 2014, 04:37 PM
Hi Kenneth,

The requested functionality is not supported by Telerik reports, as it is more native for grid controls.

The selected by you approach to navigate to other page (URL), where you can send data through the query string, is a good alternative to grid's interactivity. The custom logic for data manipulation can be perfomed in the page, and then you can navigate back to the report.


Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
General Discussions
Asked by
Kenneth
Top achievements
Rank 2
Iron
Answers by
Kenneth
Top achievements
Rank 2
Iron
Squall
Top achievements
Rank 1
Stef
Telerik team
Share this question
or