Hi Michael,
As or the custom user control, do you mean the ascx user control(or a
custom server control)?
I'm still not quite sure about the "TestContainer" you mentioned, is it the
parent container of a control on page at runtime?Generally, for any ASP.NET
server control on page, it will have a NamingContainer(if it is not the top
level control), and this NamingContainer will affect the control's actual
UniqueID and ClientID when rendering. Control can access its
NamingContainer through the "NamingContainer" property at runtime.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= <m_j_sorens@newsgroup.nospam>
>Subject: Awareness of user control TestContainer
>Date: Thu, 27 Mar 2008 16:43:01 -0700
>In my code for a custom user control, is there a way to determine whether or
>not I am inside the standard user control TestContainer? I was hoping that I
[quoted text clipped - 6 lines]
>
>I am running VS2008, with .NET 2 or 3 or 3.5.
michael sorens - 28 Mar 2008 14:39 GMT
Sorry for the ambiguity... this is a WinForm not a WebForm. The User Control
TestContainer is a vehicle of Visual Studio that automatically runs a user
control when you press F5 for a user control library project.
Steven Cheng [MSFT] - 31 Mar 2008 04:02 GMT
Thanks for the reply Michael,
Seems I also incorrectly assume that this is an ASP.NET issue(as I often
see your posts on ASP.NET :) ).
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= <m_j_sorens@newsgroup.nospam>
>References: <02A640DA-A44D-4EA7-B654-A07010155820@microsoft.com>
<CFtCvNIkIHA.6264@TK2MSFTNGHUB02.phx.gbl>
>Subject: RE: Awareness of user control TestContainer
>Date: Fri, 28 Mar 2008 06:39:00 -0700
>Sorry for the ambiguity... this is a WinForm not a WebForm. The User Control
>TestContainer is a vehicle of Visual Studio that automatically runs a user
>control when you press F5 for a user control library project.
Linda Liu[MSFT] - 31 Mar 2008 07:45 GMT
Hi Michael,
Thank you for your reply!
Based on my understanding, you have a user control class library project
which contains a custom user control and you create a test project for the
custom user control. What you want is to determine from within the custom
control's code whether the custom control is created inside a test
container. If I'm off base, please feel free to let me know.
IMO, the custom control has no chance to know whether it is created inside
a test container or not. All classes and methods provided by the Unit
Testing Framework are used in test class and methods, rather that in the
classes or methods to test.
A workaround of your question is to add a property of type bool in the
custom control to indicate whether it is initialized inside a test
container or not. The default value of this property is false. You can set
this property to true from within the test method. You can then decide how
the custom control renders depending on this bool property.
Hope this helps.
If you have any question, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@microsoft.com.
This posting is provided "AS IS" with no warranties, and confers no rights.