none
Is it possible to disable View Report button in ReportViewer control?

    Question

  • I'm using VS2008 in conjunction with 2005 SSRS, and the ProcessingMode of my ReportViewer control is Remote if that matters.

    I can disable the entire tool bar in my ReportViewer control because it's exposed in that control's properites, but can I somehow disable the View Report button?  I want the user to be able to access and select report parameters without being able to preview the report...is this possible? 

    • Moved by Helen Zhou Monday, June 13, 2011 2:36 AM (From:Windows Forms Data Controls and Databinding)
    Friday, June 10, 2011 10:11 PM

Answers

  • I reworked things so that the user selects the report parameters outside of the reportviewer, which enabled me to hide the View Report button and pass in the report parameters instead:

    private void LoadReport(string rptName, string pValue1, string pValue2)
    {
      rptViewer.ShowParameterPrompts = false;
      ReportParameter[] rptParameters = new ReportParameter[2];
      rptParameters[0] = new ReportParameter(parameter1, pValue1);
      rptParameters[1] = new ReportParameter(parameter2, pValue2);
      rptViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
      rptViewer.ServerReport.ReportServerUrl = new Uri("http://xxx.xxx.xxx.xxx/ReportServer");
      rptViewer.ServerReport.ReportServerCredentials.NetworkCredentials = new System.Net.NetworkCredential("username", "password");
      rptViewer.ServerReport.ReportPath = "/MyReports/" + rptName;
      rptViewer.ServerReport.SetParameters(rptParameters);
      rptViewer.RefreshReport();
    }
    



     

    • Marked as answer by jabberpunch Friday, June 24, 2011 9:37 PM
    Friday, June 24, 2011 9:37 PM

All replies

  • Hello jabberpunch,

    This forum is for UI technology, and we have  SQL Server Reporting Services forum dedicated to this kind of questions. I'm moving it there to make it better response. Thank you for your posting.


    Helen Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, June 13, 2011 2:35 AM
  • Hi jabberpunch,

    Generally, in order disable the View Report button, we can specify the ShowParameterPrompts property to False. However, this might not meet your requirement since you need to allow users to select report parameters.

    If you only want the user to be able to access and select report parameters without being able to preview the report, you can use Report Server Web Service to retrieve parameters information instead of the ReportViewer control.

    For more information, please refer to the ReportingService2005.GetReportParameters Method at http://msdn.microsoft.com/en-us/library/reportservice2005.reportingservice2005.getreportparameters.aspx

     

    Thanks,
    Tony Chain


    Tony Chain [MSFT CSG] | Microsoft Community Support
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Thursday, June 16, 2011 2:34 AM
  • Hi Tony,

    I will definitely look into using the Web Service as you suggested, but I'm not confident that will meet my needs.  Do you know if it would be possible to somehow trap the on click event for the ReportViewer control's View Report button??  Thanks!

    Monday, June 20, 2011 7:28 PM
  • I reworked things so that the user selects the report parameters outside of the reportviewer, which enabled me to hide the View Report button and pass in the report parameters instead:

    private void LoadReport(string rptName, string pValue1, string pValue2)
    {
      rptViewer.ShowParameterPrompts = false;
      ReportParameter[] rptParameters = new ReportParameter[2];
      rptParameters[0] = new ReportParameter(parameter1, pValue1);
      rptParameters[1] = new ReportParameter(parameter2, pValue2);
      rptViewer.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Remote;
      rptViewer.ServerReport.ReportServerUrl = new Uri("http://xxx.xxx.xxx.xxx/ReportServer");
      rptViewer.ServerReport.ReportServerCredentials.NetworkCredentials = new System.Net.NetworkCredential("username", "password");
      rptViewer.ServerReport.ReportPath = "/MyReports/" + rptName;
      rptViewer.ServerReport.SetParameters(rptParameters);
      rptViewer.RefreshReport();
    }
    



     

    • Marked as answer by jabberpunch Friday, June 24, 2011 9:37 PM
    Friday, June 24, 2011 9:37 PM