これを試してみると、見つけようとしているコントロールが別のユーザー コントロールにある可能性があります。
使用するには
Label updateMessage = FindChildControl<Label>(base.Page, "updateMessage1");
if (updateMessage!=null)
{
updateMessage.Text = "new text";
}
/// <summary>
/// Similar to Control.FindControl, but recurses through child controls.
/// Assumes that startingControl is NOT the control you are searching for.
/// </summary>
public static T FindChildControl<T>(Control startingControl, string id) where T : Control
{
T found = null;
foreach (Control activeControl in startingControl.Controls)
{
found = activeControl as T;
if (found == null || (string.Compare(id, found.ID, true) != 0))
{
found = FindChildControl<T>(activeControl, id);
}
if (found != null)
{
break;
}
}
return found;
}