From: Argiris K. <be...@us...> - 2006-02-10 01:42:20
|
Update of /cvsroot/magicajax/magicajax/Core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1641/Core Modified Files: Util.cs Log Message: If the immediate child controls of the page do not include the form, search the entire control tree. Index: Util.cs =================================================================== RCS file: /cvsroot/magicajax/magicajax/Core/Util.cs,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** Util.cs 9 Feb 2006 13:40:59 -0000 1.29 --- Util.cs 10 Feb 2006 01:42:07 -0000 1.30 *************** *** 70,77 **** --- 70,106 ---- } } + + if ( id == null ) + { + // the immediate child controls of the page do not include the form, + // search the entire control tree + id = GetFormIDRecursive(page); + } #endif return id; } + private static string GetFormIDRecursive(Control parentControl) + { + string id = null; + + foreach(Control childControl in parentControl.Controls) + { + if (childControl is HtmlForm) + { + id = childControl.ClientID; + break; + } + else + { + if (childControl.HasControls()) + { + id = GetFormIDRecursive(childControl); + } + } + } + return id; + } + /// <summary> /// Add 'defer' attribute to script tags excluding external script files. |