//search for a button control within a table cell TableCell tableCell = new TableCell(); Button buttonControl = (Button)tableCell.FindControl("submitButton"); buttonControl.Text = "Submit";
//search for a label control within a table cell TableCell tableCell = new TableCell(); Label labelControl = (Label)tableCell.FindControl("errorMessage"); if (labelControl != null) { labelControl.Text = "An error has occurred."; }This code demonstrates how to search for a label control named "errorMessage" within a TableCell object. Once the control is found, it is cast to a Label object and its Text property is modified if it is not null. The TableCell.FindControl method is included in the System.Web.UI.WebControls namespace, which is part of the ASP.NET web application development framework. Therefore, this method can be found in the System.Web.dll library.