Created
March 22, 2016 11:31
-
-
Save gerardolima/358a69c6159e584abc1f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// ====================================================================== | |
| /// This gist is intended to be copy-and-pasted to the codebehind cs file | |
| /// for a aspx page; please check the InitializeComponent before proceed. | |
| /// ====================================================================== | |
| /// <summary> | |
| /// The target page most likelly will have other event handlers, do not overwrite | |
| /// them, just add the correct event hendler to the PreRender event. | |
| /// </summary> | |
| private void InitializeComponent() { | |
| this.PreRender += new EventHandler(this.ShowAll); // bind the even handler | |
| } | |
| protected void ShowAll(object sender, EventArgs e) | |
| { | |
| ShowRecursive(MyPageUserInterfaceControl); | |
| } | |
| protected void ShowRecursive(System.Web.UI.Control container) | |
| { | |
| if(container == null) return; | |
| foreach(var control in container.Controls.OfType<System.Web.UI.WebControls.PlaceHolder>().Where(it => it != null)) | |
| { | |
| control.Visible = true; | |
| ShowRecursive(control); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment