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

@@ -1,7 +1,7 @@
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using Umbraco.Core;
using umbraco.interfaces;
using umbraco.BusinessLogic;
using umbraco.DataLayer;
@@ -175,7 +175,7 @@ namespace umbraco.cms.businesslogic.datatype
foreach (KeyValuePair<string, DataEditorSettingType> k in dtSettings)
{
var result = k.Value.Validate();
Label lbl = FindControlRecursive<Label>(this, "lbl" + k.Key);
Label lbl = this.FindControlRecursive<Label>("lbl" + k.Key);
if (result == null && lbl != null)
{
if (lbl != null)
@@ -327,24 +327,6 @@ namespace umbraco.cms.businesslogic.datatype
}
}
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);
}
}