Home All Groups Group Topic Archive Search About

Telling weither the control is in design time or on a web page

Author
2 Feb 2006 10:00 PM
GregO
Hello,
I have a web control and I want to render it differnetly when it is in
design mode as aposed to when it is on a web page.

How do I tell when it is in the different mode?

Any help would be good

Kind regards
Greg

Author
3 Feb 2006 1:15 PM
Doug Salomon
You could try putting the changes that you want in somehting like the
page_load event. Then those changes won't be apparent at design time, but
will show up at run time.

Doug

Show quoteHide quote
"GregO" wrote:

> Hello,
> I have a web control and I want to render it differnetly when it is in
> design mode as aposed to when it is on a web page.
>
> How do I tell when it is in the different mode?
>
> Any help would be good
>
> Kind regards
> Greg
>
>
>
Author
3 Feb 2006 3:59 PM
Brock Allen
You can establish a control designer for your custom control. A control designer
is what emits the HTML to be shown in VS.NET's design view. Also in v2.0
they added a DesignMode bool property to let you know if you are in the designer.

-Brock
http://staff.develop.com/ballen


Show quoteHide quote
> Hello,
> I have a web control and I want to render it differnetly when it is in
> design mode as aposed to when it is on a web page.
> How do I tell when it is in the different mode?
>
> Any help would be good
>
> Kind regards
> Greg
Author
22 Feb 2006 8:21 PM
JoNaS
When you say web control I imagine you're talking about web server controls
and not user controls. Any way, I had a similar issue and I came up with this
idea:
Public Sub New()
        _IsDevEnvironment =
(System.Diagnostics.Process.GetCurrentProcess().MainModule.ModuleName =
"devenv.exe")
End Sub

This will let you know if the process accessing the control is devenv.exe or
not.
Note: this will only work with vs2003 as I do not know what the new name of
the process for 2005 is called.

I'm not sure if this has a hit on performance or not and how big that hit
will be.

Show quoteHide quote
"GregO" wrote:

> Hello,
> I have a web control and I want to render it differnetly when it is in
> design mode as aposed to when it is on a web page.
>
> How do I tell when it is in the different mode?
>
> Any help would be good
>
> Kind regards
> Greg
>
>
>