Language: C#
FindControlUsingStack
public static Control FindControlUsingStack(Control root, string id) { // Seed it. Stack<Control> stack = new Stack<Control>(); stack.Push(root); while(stack.Count > 0) { Control current = stack.Pop(); if (current.ID == id) return current; foreach (Control control in current.Controls) { stack.Push(control); } } return null; }
Tags:
Report Abuse
Subscribe
Discuss
What's new
What is it
New Snippet
Recent Snippets
My Snippets
Web Code
Search

