Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ReportViewer - modify toolbar?

Tags:

People also ask

What is Report Viewer control?

Report viewer controls are . NET controls that can be added to a form in a Windows or Web application, to display reports on that form.

What is Report Viewer?

Report Viewer displays report data in a clear and comprehensive way, and helps you to analyze that data.


Do anyone have good ideas of how to modify the toolbar for the WinForms version of the ReportViewer Toolbar? That is, I want to remove some buttons and varius, but it looks like the solution is to create a brand new toolbar instead of modifying the one that is there.

Like, I had to remove export to excel, and did it this way:

  // Disable excel export
  foreach (RenderingExtension extension in lr.ListRenderingExtensions()) {
    if (extension.Name == "Excel") {
      //extension.Visible = false; // Property is readonly...
      FieldInfo fi = extension.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic);
      fi.SetValue(extension, false);
    }
  }

A bit trickysh if you ask me.. For removing toolbarbuttons, an possible way was to iterate through the Control array inside the ReportViewer and change the Visible property for the buttons to hide, but it gets reset all the time, so it is not an good way..

WHEN do MS come with an new version btw?