42 lines
942 B
C#
42 lines
942 B
C#
using System;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
namespace SPSolutions.Web
|
|
{
|
|
public class ControlUtil
|
|
{
|
|
public static Control FindControl(Control control, string controlId)
|
|
{
|
|
if (control.ID == controlId)
|
|
{
|
|
return control;
|
|
}
|
|
foreach (Control control2 in control.Controls)
|
|
{
|
|
Control control3 = ControlUtil.FindControl(control2, controlId);
|
|
if (control3 != null)
|
|
{
|
|
return control3;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
public static void PrintControls(HttpResponse response, Control control)
|
|
{
|
|
ControlUtil.PrintControls(response, control, 0);
|
|
}
|
|
private static void PrintControls(HttpResponse response, Control control, int depth)
|
|
{
|
|
for (int i = 0; i < depth; i++)
|
|
{
|
|
response.Write(" ");
|
|
}
|
|
response.Write("Control: " + control.ID + "<br>");
|
|
foreach (Control control2 in control.Controls)
|
|
{
|
|
ControlUtil.PrintControls(response, control2, depth + 1);
|
|
}
|
|
}
|
|
}
|
|
}
|