Page child

The asp.net page is also a control. How can I access child management as part of page management?

this.page.? 
+4
source share
3 answers

You can access it through the Management Collection.

 Page.Controls 

Recursive FindControls from Rick Strahl's Blog

 public static Control FindControlRecursive(Control Root, string Id) { if (Root.ID == Id) return Root; foreach (Control Ctl in Root.Controls) { Control FoundCtl = FindControlRecursive(Ctl, Id); if (FoundCtl != null) return FoundCtl; } return null; } 

Be careful with this, however ... This is not a method that you want to use inside a loop or something else.

+3
source

Try the following:

 Control childControl = Page.FindControl("YourControlsID"); 
+5
source
  • Page.Controls
  • FindControl Method
+4
source

Source: https://habr.com/ru/post/1302156/


All Articles