Sometimes checking the DesignMode property is not sufficient. For example checking DesignMode in a UserControl contained in a UserControl returns false. Which is, if you think about it, correct. What you really want to know is whether or not your control is running inside VS.Net IDE.
Here is the code.
protected bool InDesignMode() { if (this.DesignMode) {return true;} if (System.Reflection.Assembly.GetEntryAssembly() == null) { return true; } return false; }
11:37:52 AM
|