Is there any way to detect that you are in preview mode in code behind file?
What I really want to do is set the DataSource = null in the report class constructor in run-time (so that the NeedDataSource event runs). But in preview I would like to use the default data source. Right now I have to comment / uncomment code to achieve this.
I thought I could put an "if in design mode" similar to the following, but wondered if there is a way to detect this in the code?
if (GetIsInDesignerPreviewMode(this))
this.DataSource = null;
Thanks for your feedback and recommendations.
What I really want to do is set the DataSource = null in the report class constructor in run-time (so that the NeedDataSource event runs). But in preview I would like to use the default data source. Right now I have to comment / uncomment code to achieve this.
I thought I could put an "if in design mode" similar to the following, but wondered if there is a way to detect this in the code?
if (GetIsInDesignerPreviewMode(this))
this.DataSource = null;
Thanks for your feedback and recommendations.