2003-01-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / class / System.Web / System.Web.Compilation / AspGenerator.cs
index 748f008d9ce9baa13ffba80537f10419fd8543bd..8aebca2408759595ea186742458bd5c6922a9802 100644 (file)
@@ -577,12 +577,16 @@ class AspGenerator
        {
                // First try loaded assemblies, then try assemblies in Bin directory.
                // By now i do this 'by hand' but may be this is a runtime/gac task.
-               Type type = Type.GetType (typeName);
-               if (type != null)
-                       return type;
+               Type type = null;
+               Assembly [] assemblies = AppDomain.CurrentDomain.GetAssemblies ();
+               foreach (Assembly ass in assemblies) {
+                       type = ass.GetType (typeName);
+                       if (type != null)
+                               return type;
+               }
 
-               string [] binDlls = Directory.GetFiles (privateBinPath, "*.dll");
                Assembly assembly;
+               string [] binDlls = Directory.GetFiles (privateBinPath, "*.dll");
                foreach (string dll in binDlls) {
                        string dllPath = Path.Combine (privateBinPath, dll);
                        assembly = null;
@@ -706,7 +710,6 @@ class AspGenerator
                        switch (data.result) {
                        case UserControlResult.OK:
                                AddUsing ("ASP");
-                               string dll = "output" + Path.DirectorySeparatorChar + data.assemblyName + ".dll";
                                Foundry.RegisterFoundry (tag_prefix, tag_name, data.assemblyName, "ASP", data.className);
                                AddReference (data.assemblyName);
                                break;
@@ -939,10 +942,11 @@ class AspGenerator
                string control_type_string = controls.PeekType ().ToString ();
                StringBuilder db_function = controls.DataBindFunction;
                string container;
-               if (controls.Container == null)
+               if (controls.Container == null || !typeof (INamingContainer).IsAssignableFrom (controls.Container))
                        container = "System.Web.UI.Control";
-               else
+               else {
                        container = controls.Container.ToString ();
+               }
 
                if (db_function.Length == 0)
                        db_function.AppendFormat ("\t\tpublic void __DataBind_{0} (object sender, " + 
@@ -1093,8 +1097,20 @@ class AspGenerator
                                                               "FromArgb ({1}, {2}, {3}, {4});\n",
                                                               var_name, c.A, c.R, c.G, c.B);
                        }
-               }       
-               else {
+               }
+               else if (type == typeof (string [])) {
+                       string [] subStrings = att.Split (',');
+                       current_function.AppendFormat ("\t\t\t__ctrl.{0} = new String [] {{\n", var_name);
+                       int end = subStrings.Length;
+                       for (int i = 0; i < end; i++) {
+                               string s = subStrings [i].Trim ();
+                               current_function.AppendFormat ("\t\t\t\t\"{0}\"", s);
+                               if (i == end - 1)
+                                       current_function.Append ("\t\t\t\t};\n");
+                               else
+                                       current_function.Append (",\n");
+                       }
+               } else {
                        throw new ApplicationException ("Unsupported type in property: " + 
                                                        type.ToString ());
                }