Moves all FindCOntrolRecursive calls to an extension method

This commit is contained in:
Shannon
2014-02-19 23:49:08 +11:00
parent 1618ac86b8
commit 2e25bc8fdb
5 changed files with 54 additions and 78 deletions

View File

@@ -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
}
}