Moves all FindCOntrolRecursive calls to an extension method
This commit is contained in:
@@ -8,7 +8,7 @@ using System.Web.UI.WebControls;
|
||||
using System.Web.UI.WebControls.WebParts;
|
||||
using System.Web.UI.HtmlControls;
|
||||
using System.IO;
|
||||
|
||||
using Umbraco.Core;
|
||||
using umbraco.DataLayer;
|
||||
using umbraco.BusinessLogic;
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace umbraco.editorControls.userControlGrapper
|
||||
foreach (KeyValuePair<string, DataEditorSettingType> k in dtSettings)
|
||||
{
|
||||
var result = k.Value.Validate();
|
||||
Label lbl = FindControlRecursive<Label>(_phSettings, "lbl" + k.Key);
|
||||
Label lbl = _phSettings.FindControlRecursive<Label>("lbl" + k.Key);
|
||||
if(result == null && lbl != null)
|
||||
{
|
||||
if(lbl != null)
|
||||
@@ -320,25 +320,6 @@ namespace umbraco.editorControls.userControlGrapper
|
||||
}
|
||||
}
|
||||
|
||||
private static T FindControlRecursive<T>(Control parent, string id) where T : Control
|
||||
{
|
||||
if ((parent is T) && (parent.ID == id))
|
||||
{
|
||||
return (T)parent;
|
||||
}
|
||||
|
||||
foreach (Control control in parent.Controls)
|
||||
{
|
||||
T foundControl = FindControlRecursive<T>(control, id);
|
||||
if (foundControl != null)
|
||||
{
|
||||
return foundControl;
|
||||
}
|
||||
}
|
||||
return default(T);
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user