asp.net.ph

Control.FindControl Method

System.Web.UI Namespace   Control Class


Searches the current naming container for the specified server control.

Overload List

1. Searches the current naming container for a server control with the specified id parameter.

2. This member supports the .NET Framework infrastructure and is not intended to be used directly from your code.


Example

The following example demonstrates using the FindControl method.

NOTE: This example shows how to use one of the overloaded versions of FindControl. For other examples that might be available, see the individual overload topics.

private void Button1_Click ( object sender, EventArgs MyEventArgs ) {
   // Find control on page.
   Control myControl1 = FindControl ( "TextBox2" );
   if ( myControl1 != null ) {
      // Get control's parent.
      Control myControl2 = myControl1.Parent;
      Response.Write ( "Parent of the text box is : " + myControl2.ID );
   } else {
      Response.Write ( "Control not found" );
   }
}
  C# VB

See Also

Control Members Skip Navigation Links




Previous page Back to top Next page

Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note