Author: mhabersack
Date: 2007-06-06 09:06:23 -0400 (Wed, 06 Jun 2007)
New Revision: 78731

Modified:
   trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
   trunk/mcs/class/System.Web/System.Web.UI/Control.cs
Log:
2007-06-06  Marek Habersack  <[EMAIL PROTECTED]>

        * Control.cs: more changes to the way TemplateSourceDirectory
        works in the 2.0 profile. Take into account situations when a
        control is placed in a UserControl (.ascx) and only then fall back
        to the parent for its TemplateSourceDirectory.


Modified: trunk/mcs/class/System.Web/System.Web.UI/ChangeLog
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2007-06-06 12:26:04 UTC 
(rev 78730)
+++ trunk/mcs/class/System.Web/System.Web.UI/ChangeLog  2007-06-06 13:06:23 UTC 
(rev 78731)
@@ -1,3 +1,10 @@
+2007-06-06  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * Control.cs: more changes to the way TemplateSourceDirectory
+       works in the 2.0 profile. Take into account situations when a
+       control is placed in a UserControl (.ascx) and only then fall back
+       to the parent for its TemplateSourceDirectory.
+
 2007-06-05  Marek Habersack  <[EMAIL PROTECTED]>
 
        * Control.cs: TemplateSourceDirectory uses TemplateControl to

Modified: trunk/mcs/class/System.Web/System.Web.UI/Control.cs
===================================================================
--- trunk/mcs/class/System.Web/System.Web.UI/Control.cs 2007-06-06 12:26:04 UTC 
(rev 78730)
+++ trunk/mcs/class/System.Web/System.Web.UI/Control.cs 2007-06-06 13:06:23 UTC 
(rev 78731)
@@ -398,7 +398,13 @@
                 public virtual string TemplateSourceDirectory {
                        get {
 #if NET_2_0
-                               return (_templateControl == null) ? 
String.Empty : _templateControl.TemplateSourceDirectory;
+                               if (_templateControl != null)
+                                       return 
_templateControl.TemplateSourceDirectory;
+
+                               // Arguably, a hack, but this is the easiest 
way of doing it. We must be sure that controls placed
+                               // in an .ascx file get their source directory 
right, or otherwise ResolveClientUrl will return
+                               // invalid paths in such situations.
+                               return (_parent == null || !(_parent is 
UserControl)) ? String.Empty : _parent.TemplateSourceDirectory;
 #else
                                return (_parent == null) ? String.Empty : 
_parent.TemplateSourceDirectory;
 #endif

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to