This is a migrated thread and some comments may be shown as answers.

Determine if preview mode

1 Answer 103 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
David A.
Top achievements
Rank 1
David A. asked on 30 Jul 2014, 05:39 PM
Hi,

I am trying to conditionally skip code when in design mode, and normally use the following:

if (LicenseManager.UsageMode == LicenseUsageMode.Designtime)
               return;

However, when previewing reports hooked up to a temporary objectdatasource, this above code does not work.  Is there a way to determine if I am in report preview mode?  The reason I ask is that I want to bypass the _NeedDataSource event if I am in VS and previewing the report.

Thanks,
David A.

1 Answer, 1 is accepted

Sort by
0
Accepted
Stef
Telerik team
answered on 04 Aug 2014, 04:21 PM
Hello David,

Telerik Reporting is integrated tool, where on preview in the VS Report Designer the start application is Visual Studio.

Possible approach to handle the case is described by my colleague in the following forum thread: DesignMode property. Based on the provided explanation you can also use an approach to detect which is the running process e.g.:
public bool isInDesignMode
       {
           get
           {
               System.Diagnostics.Process process = System.Diagnostics.Process.GetCurrentProcess();
               bool res = process.ProcessName == "devenv";
               process.Dispose();
               return res;
           }
       }


I hope the above information helps you.

Regards,
Stef
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Report Designer (standalone)
Asked by
David A.
Top achievements
Rank 1
Answers by
Stef
Telerik team
Share this question
or