Web UserControl - how to determine whether running in IDE

  • Thread starter Thread starter Ben Fidge
  • Start date Start date
B

Ben Fidge

As the Web UserControl class has no DesignMode property
(it's not derived from Component), how do you tell if
your UserControl is running in the IDE.

I've got a public property on my UserControl that
persists it's value to the ViewState in its "set"
accessor, and reads it's value from there in its "get"
accessor. Obviously, at design time the ViewState is not
available and the IDE throws an exception when I open the
UserControl's "edit window" in the IDE. I know for sure
that this is due to my property's "get" accessor trying
to read from the ViewState.

How do I determine if my Usercontrol is running from
within the IDE?

Thanks

Ben
 
How do I determine if my Usercontrol is running from
within the IDE?

The VS.NET IDE acts as a "debugger", so check out:

System.Diagnostics.Debugger.IsAttached
 
Back
Top