Report Viewer Costumize

Stimulsoft Reports.NET discussion
Post Reply
RDStech
Posts: 3
Joined: Wed Nov 29, 2017 11:38 am

Report Viewer Costumize

Post by RDStech »

hi
I am using Stimulsoft Report 2015 Ultimate. I want to hide "Save" and "Open" button is in viewer occasionally,
i have seen the Stimulsoft Sample "Costume VIew" but it shows report in a form, while i am going to use report viewer itself.
so the methode does not worked for me
by default i am using these lines to generate report:

Code: Select all

private void btnItemList_Click(object sender, EventArgs e)
        {
            ItemListReport.Dictionary.Variables.Add("ProjectName", Globals.ProjectName);
            ItemListReport.Dictionary.Variables.Add("ProjectCode", Globals.ProjectCode);
            ItemListReport.Dictionary.Variables.Add("Username", Globals.SajiranClient.Username);
            ItemListReport.Compile();
            ItemListReport.Render();
            ItemListReport.Show();
            ItemListReport.ViewerControl = PreviewControl;  }
also, i was using this to hide those controls, but no success:

Code: Select all

private void btnItemList_Click(object sender, EventArgs e)
        {
            Stimulsoft.Report.Viewer.StiViewerControl PreviewControl = new Stimulsoft.Report.Viewer.StiViewerControl();
            PreviewControl.ShowOpen = false;
            PreviewControl.ShowSave = false;
            PreviewControl.ShowSendEMail = false;
            PreviewControl.Report = ItemListReport;
            PreviewControl.SaveConfig();
            PreviewControl.Refresh();
            PreviewControl.LoadConfig();
           
            ItemListReport.Dictionary.Variables.Add("ProjectName", Globals.ProjectName);
            ItemListReport.Dictionary.Variables.Add("ProjectCode", Globals.ProjectCode);
            ItemListReport.Dictionary.Variables.Add("Username", Globals.SajiranClient.Username);
            
            ItemListReport.Compile();
            
            ItemListReport.Render();
            ItemListReport.Show();
            


        }
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Re: Report Viewer Costumize

Post by Edward »

Hi RDStech,

You absolutely correct and your code in sample 1 is fine. It should work. For the second code snippet though, please follow the advice as per the following topic:
viewtopic.php?f=8&t=6

If you still having an issue, please feel free to send a quick sample we could test with to support[at]stimulosft.com, or you could modify one of our standard samples in order to reproduce the issue.
https://www.stimulsoft.com/en/samples/winforms

Thank you,
Edward
RDStech
Posts: 3
Joined: Wed Nov 29, 2017 11:38 am

Re: Report Viewer Costumize

Post by RDStech »

Thank You, Edward,
i tried both methods but no success again

this is what i did actually:
please tell me what is wrong in this snippet ( i have commented Config methode)

Code: Select all

private void btnItemList_Click(object sender, EventArgs e)
        {
             //StiConfig.Load();
            //StiPreviewConfigService config = StiConfig.Services.GetService(typeof(StiPreviewConfigService)) as StiPreviewConfigService;
            //config.SaveEnabled = false;
            //config.OpenEnabled = false;
            //StiConfig.Save();

            Stimulsoft.Report.Render.StiPreviewControl stiPreview = new Stimulsoft.Report.Render.StiPreviewControl(ItemListReport);
            stiPreview.ShowSave = false;
            stiPreview.ShowOpen = false;
            stiPreview.ShowSendEMail = false;


            ItemListReport.Dictionary.Variables.Add("ProjectName", Globals.ProjectName);
            ItemListReport.Dictionary.Variables.Add("ProjectCode", Globals.ProjectCode);
            ItemListReport.Dictionary.Variables.Add("Username", Globals.SajiranClient.Username);
            ItemListReport.Compile();
            ItemListReport.Render();
            ItemListReport.Show();



        }
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

Re: Report Viewer Costumize

Post by Lech Kulikowski »

Hello,

Please send us a simple project on support@stimulsoft.com for analysis.

Thank you.
Post Reply