Web UserControl - how to determine whether running in IDE

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
 
P

Patrick Steele [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top