Disabling Toolbar items in web Viewer

Stimulsoft Reports.WEB discussion
Post Reply
Metusariel
Posts: 9
Joined: Wed Sep 04, 2013 3:39 pm

Disabling Toolbar items in web Viewer

Post by Metusariel »

Hi,

I know this has been discused before, i've already searched and read the forum threads about disabling / hiding toolbar buttons in the web viewer (asp .net), but cant make this work.

Im using Version=2013.3.1800 (full version) and using this code (only showing relevant lines):

Code: Select all

using vwrv = Stimulsoft.Report.StiOptions.Viewer.Windows;

 private void ConfiguraVisor(bool bPermiso)
    {
        vwrv.ShowSaveButton = bPermiso;
        vwrv.ShowPrintButton = bPermiso;

        if (!bPermiso)
        {
            vwrv.Exports.ShowBmp = false;
            vwrv.Exports.ShowCsv = false;
            vwrv.Exports.ShowData = false;
            vwrv.Exports.ShowDbf = false;
            vwrv.Exports.ShowDif = false;
            vwrv.Exports.ShowExcel = false;
            vwrv.Exports.ShowExcel2007 = true;
            vwrv.Exports.ShowExcelXml = false;
            vwrv.Exports.ShowGif = false;
            vwrv.Exports.ShowHtml = false;
            vwrv.Exports.ShowHtml5 = false;
            vwrv.Exports.ShowExcelXml = false;
            vwrv.Exports.ShowImage = false;
            vwrv.Exports.ShowJpeg = true;
            vwrv.Exports.ShowMetafile = false;
            vwrv.Exports.ShowMht = false;
            vwrv.Exports.ShowOds = true;
            vwrv.Exports.ShowOdt = true;
            vwrv.Exports.ShowPcx = false;
            vwrv.Exports.ShowPdf = true;
            vwrv.Exports.ShowPng = true;
            vwrv.Exports.ShowPpt2007 = false;
            vwrv.Exports.ShowRtf = false;
            vwrv.Exports.ShowSvg = false;
            vwrv.Exports.ShowSvgz = false;
            vwrv.Exports.ShowText = false;
            vwrv.Exports.ShowTiff = false;
            vwrv.Exports.ShowWord2007 = true;
            vwrv.Exports.ShowXml = false;
            vwrv.Exports.ShowXps = false;
            vwrv.ShowSaveButton = false;
        }    
    }
Now, i've already tried calling ConfiguraVisor(boolean) either in Page_Init and just before

Code: Select all

Report.Render(true);
this.ReportViewer = rpt;

The issue here is that Save and Print buttons are showing and enabled, no matter the value of the boolean parameter im passing.

Any help or insight you can provide would be greatly appreciated!
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Disabling Toolbar items in web Viewer

Post by HighAley »

Hello.

You are setting the wrong options.
You should set properties of the WebViewer.

Code: Select all

StiWebViewer1.ShowExportToBmp = false;
StiWebViewer1.ShowPrintButton = false;
and so on.

Thank you.
Metusariel
Posts: 9
Joined: Wed Sep 04, 2013 3:39 pm

Re: Disabling Toolbar items in web Viewer

Post by Metusariel »

Thanks a lot Aleksey,

I've got distracted from this project a few tme ago, but today i finally came back to finish it and saw your post.

using the properties you mentioned worked like a charm (perhaps documentation needs a big update).

With this sorted, i have to ask, is there a way to disable this toolbar buttons AFTER Page_init event?

Im currently using viewer inside a user control, which fires its Page_init before the page dows, but i need to enable / disable button according to a value i get after a postback event.
Vladimir
Posts: 1462
Joined: Fri Apr 13, 2007 4:05 am
Location: Earth

Re: Disabling Toolbar items in web Viewer

Post by Vladimir »

Hello,

Please specify in which event you want to hide elements of the WebViewer component? Please give an example.

You can hide any element of the component via Javascript: find element by its Id and set its style to "display: none;"

Thank you.
Post Reply