Export (0) Print
Expand All
2 out of 6 rated this helpful - Rate this topic

Page::FindControl Method (String)

Searches the page naming container for a server control with the specified identifier.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)
public:
virtual Control^ FindControl(
	String^ id
) override

Parameters

id
Type: System::String
The identifier for the control to be found.

Return Value

Type: System.Web.UI::Control
The specified control, or nullptr if the specified control does not exist.

The FindControl method can be used to access a control whose ID is not available at design time. The method searches only the page's immediate, or top-level, container; it does not recursively search for controls in naming containers contained on the page. To access controls in a subordinate naming container, call the FindControl method of that container.

The following code example demonstrates how to use the FindControl method to locate controls inside templates. In this example, two Repeater controls are defined; each shows a different way to catch the Click event of a LinkButton inside the repeater item template.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.