C#
Hi,
I’ve been developing c# web applications for a couple of years and there is one issue I keep coming upagainst that I can’t find a logical way to solve.
I have a control I wish to access in code behind, this control is deep within the markup; burried within ContentPlaceHolders, UpdatePanels, Panels, GridViews, EmptyDataTemplates, TableCells (or whatever structure you like.. the point is it has more parents than farthers for justice).
How can I use FindControl("") to access this control without doing this:
Page.Form.Controls[1].Controls[1].Controls[4].Controls[1].Controls[13].Controls[1].Controls[0].Controls[0].Controls[4].FindControl("");
Write a helper method called FindControlRecursive as provided by Jeff Atwood himself.
Recursive Page.FindControl