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

Jump to bookmark with code in ReportViewer

1 Answer 101 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sascha
Top achievements
Rank 1
Sascha asked on 20 Dec 2018, 07:50 AM

I am embedding the ReportViewer in a WPF application. I have a very long report and I want to provide an easy way for the user to navigate in the report.

 

To achieve an integrated feeling for the user, I'd like to add some buttons to the application that allow the user to jump to certain bookmarks within the report. I cannot use the current page for the purpose, because the length of the sections is dynamic.

 

I found two older threads with a similar requirement, but they were not really solved by Telerik:

https://www.telerik.com/forums/navigate-to-a-bookmark-through-code

https://www.telerik.com/forums/navigating-to-bookmark-from-code

 

Is there some active development regarding this? Or any workaround? If there were events during rendering that allowed me to capture the report page of every bookmark, this would be sufficient. But I couldn't find anything like this.

 

I am also fine with calling internal methods using reflection if that's a quick workaround, because I need the functionality very soon.

 

Thanks,

Sascha

1 Answer, 1 is accepted

Sort by
0
Ivan Hristov
Telerik team
answered on 28 Dec 2018, 09:24 AM
Hello Sascha,

Unfortunately this functionality is not yet supported. The bookmark navigation is handled internally and there are no exposed methods to control it. I can suggest to log this feature in our Feedback & Ideas portal and see how the community will vote for it. The users demand for a specific feature will allow us to determine its priority and schedule it for implementation in a future release of our product.

However, these private methods can be accessed via reflection as the following code demonstrates:
private void btnNavigateToBookmark_Click(object sender, RoutedEventArgs e)
{
    var bookmark = this.tbBookmark.Text.Trim(); //the bookmark text to navigate to.
    var modelPropInfo = typeof(Telerik.ReportViewer.Wpf.ReportViewer)
                            .GetProperty("Model", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
    var model = modelPropInfo.GetValue(this.ReportViewer1, null);           
    var navigateMethodInfo = model.GetType().GetMethod("NavigateToBookmark",
                                                        System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic,
                                                        Type.DefaultBinder,
                                                        new[] { typeof(string) },
                                                        null );
    navigateMethodInfo.Invoke(model, new[] { bookmark });
}

I'm sure you understand the possible problems that may occur when using reflection, but I want to emphasize again that the methods called in this code snippet are intended for internal use only and may change in a future release of our product, making the above code unusable.

 If you have further questions, please let us know.

Regards,
Ivan Hristov
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Sascha
Top achievements
Rank 1
Answers by
Ivan Hristov
Telerik team
Share this question
or