Page 1 of 1

Report Viewer Costumize

Posted: Tue May 15, 2018 8:22 am
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();
            


        }

Re: Report Viewer Costumize

Posted: Wed May 16, 2018 5:25 am
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

Re: Report Viewer Costumize

Posted: Wed May 16, 2018 10:05 am
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();



        }

Re: Report Viewer Costumize

Posted: Thu May 17, 2018 6:47 pm
by Lech Kulikowski
Hello,

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

Thank you.