How to judge whether it is under the design mode?

L

Laser Lu

I want to judge whether it is currently under the design mode in the code when I was developing a web control. The question is how to achieve it? Is there any property that indicates the current mode the code was runnig under?
 
J

Jim Cheshire [MSFT]

Hi,

One way to do this is to check HttpContext.Current. If it's null, you are
in design mode.

Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
(e-mail address removed)

This post is provided "AS-IS" with no warranties and confers no rights.

--------------------
Thread-Topic: How to judge whether it is under the design mode?
thread-index: AcRH0ByXWCzwZIgNTv+AOISpBL1/pw==
X-WN-Post: microsoft.public.dotnet.framework.aspnet.webcontrols
From: "=?Utf-8?B?TGFzZXIgTHU=?=" <[email protected]>
Subject: How to judge whether it is under the design mode?
Date: Tue, 1 Jun 2004 05:01:03 -0700
Lines: 1
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
Path: cpmsftngxa10.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontrols:21065
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols

I want to judge whether it is currently under the design mode in the code
when I was developing a web control. The question is how to achieve it? Is
there any property that indicates the current mode the code was runnig
under?
 
L

Laser Lu

A further question: How to get the file path of the current editing aspx page

----- Jim Cheshire [MSFT] wrote: ----

Hi,

One way to do this is to check HttpContext.Current. If it's null, you are
in design mode

Jim Cheshire, MCSE, MCSD [MSFT
ASP.NE
Developer Suppor
(e-mail address removed)

This post is provided "AS-IS" with no warranties and confers no rights

-------------------
Thread-Topic: How to judge whether it is under the design mode
thread-index: AcRH0ByXWCzwZIgNTv+AOISpBL1/pw=
X-WN-Post: microsoft.public.dotnet.framework.aspnet.webcontrol
From: "=?Utf-8?B?TGFzZXIgTHU=?=" <[email protected]>>Subject: How to judge whether it is under the design mode
Date: Tue, 1 Jun 2004 05:01:03 -070
Lines:
Message-ID: <[email protected]>>MIME-Version: 1.
Content-Type: text/plain
charset="Utf-8
Content-Transfer-Encoding: 7bi
X-Newsreader: Microsoft CDO for Windows 200
Content-Class: urn:content-classes:messag
Importance: norma
Priority: norma
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.
Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrol
Path: cpmsftngxa10.phx.gb
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontrols:2106
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.18
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrol
when I was developing a web control. The question is how to achieve it? Is
there any property that indicates the current mode the code was runnig
under
 
L

Laser Lu

I'm now developing a web control. However, some information necessary to render the control is unavailable at design time. So I have to get accessed to the design time object model of the IDE, in order to find a alternative information. Then how to access the design time object model?
 
L

Laser Lu

For example, if I want to get the information of the currently editting aspx file, then how to do it

----- Laser Lu wrote: ----

I'm now developing a web control. However, some information necessary to render the control is unavailable at design time. So I have to get accessed to the design time object model of the IDE, in order to find a alternative information. Then how to access the design time object model?
 
J

Jim Cheshire [MSFT]

Laser,

What information specifically are you looking for?

Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
(e-mail address removed)

This post is provided "AS-IS" with no warranties and confers no rights.

--------------------
Thread-Topic: How to judge whether it is under the design mode?
thread-index: AcRITSPDHSBJmcOISGmBgOvOF0BBKA==
X-WN-Post: microsoft.public.dotnet.framework.aspnet.webcontrols
From: "=?Utf-8?B?TGFzZXIgTHU=?=" <[email protected]>
References: <[email protected]>
Subject: RE: How to judge whether it is under the design mode?
Date: Tue, 1 Jun 2004 19:56:02 -0700
Lines: 5
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
Path: cpmsftngxa10.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontrols:21086
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols

For example, if I want to get the information of the currently editting
aspx file, then how to do it?

----- Laser Lu wrote: -----

I'm now developing a web control. However, some information necessary
to render the control is unavailable at design time. So I have to get
accessed to the design time object model of the IDE, in order to find a
alternative information. Then how to access the design time object model?
 
L

Laser Lu

For example, I want to get the file path of the currently editing aspx page in code. Is that possible?
 
J

Jim Cheshire [MSFT]

Hi,

Yes, it is possible via extensibility. DTE.ActiveDocument.FullName will
return the path to the document currently being edited.

Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
(e-mail address removed)

This post is provided "AS-IS" with no warranties and confers no rights.

--------------------
Thread-Topic: How to judge whether it is under the design mode?
thread-index: AcRLpX3M2N4CeykVQk6vSMjOWxuWXA==
X-WN-Post: microsoft.public.dotnet.framework.aspnet.webcontrols
From: "=?Utf-8?B?TGFzZXIgTHU=?=" <[email protected]>
References: <[email protected]>
<[email protected]>
Subject: RE: How to judge whether it is under the design mode?
Date: Sun, 6 Jun 2004 02:06:02 -0700
Lines: 1
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
Path: cpmsftngxa10.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontrols:21193
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols

For example, I want to get the file path of the currently editing aspx
page in code. Is that possible?
 
J

Jim Cheshire [MSFT]

Good deal. Thanks for updating. Glad to help.

Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
(e-mail address removed)

This post is provided "AS-IS" with no warranties and confers no rights.


--------------------
Thread-Topic: How to judge whether it is under the design mode?
thread-index: AcRMsQT/HcjI5EhLQtmSBnK/8HMRxw==
X-WN-Post: microsoft.public.dotnet.framework.aspnet.webcontrols
From: "=?Utf-8?B?TGFzZXIgTHU=?=" <[email protected]>
References: <[email protected]>
<[email protected]>
<[email protected]>
<[email protected]>
Subject: RE: How to judge whether it is under the design mode?
Date: Mon, 7 Jun 2004 10:01:04 -0700
Lines: 41
Message-ID: <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
Path: cpmsftngxa10.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontrols:21209
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
Hi, Jim! Thank you very much!! It really works!
----- Jim Cheshire [MSFT] wrote: -----

Hi,

Yes, it is possible via extensibility. DTE.ActiveDocument.FullName
will
return the path to the document currently being edited.

Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
(e-mail address removed)

This post is provided "AS-IS" with no warranties and confers no rights.

--------------------
Thread-Topic: How to judge whether it is under the design mode?
thread-index: AcRLpX3M2N4CeykVQk6vSMjOWxuWXA==
X-WN-Post: microsoft.public.dotnet.framework.aspnet.webcontrols
From: "=?Utf-8?B?TGFzZXIgTHU=?="
<[email protected]>>References:
<[email protected]><9857E26A-6E51-4529-8F7A
(e-mail address removed)><3DFFF806-3F6E-4FC4-90D9-C54457BC9AF4@microsoft.
com> said:
Date: Sun, 6 Jun 2004 02:06:02 -0700
Lines: 1
Message-ID:
Content-Type: text/plain;
charset="Utf-8"
Content-Transfer-Encoding: 7bit
X-Newsreader: Microsoft CDO for Windows 2000
Content-Class: urn:content-classes:message
Importance: normal
Priority: normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Newsgroups: microsoft.public.dotnet.framework.aspnet.webcontrols
Path: cpmsftngxa10.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webcontrols:21193
NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webcontrols
aspx
page in code. Is that possible?
 

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,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top