Created
March 19, 2014 16:05
-
-
Save devfred/9645055 to your computer and use it in GitHub Desktop.
csharp: Count number of modules in pane.
This file contains 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
private int CountPaneModules (string paneName) | |
{ | |
int count = 0; | |
foreach (System.Web.UI.Control control in this.Controls) | |
{ | |
System.Web.UI.HtmlControls.HtmlContainerControl htmlContainerControl = control as System.Web.UI.HtmlControls.HtmlContainerControl; | |
string a; | |
if (htmlContainerControl != null && !string.IsNullOrEmpty(htmlContainerControl.ID) && (a = htmlContainerControl.TagName.ToLowerInvariant()) != null && (a == "td" || a == "div" || a == "span" || a == "p")) | |
{ | |
if (htmlContainerControl.ID.ToLower() == paneName.ToLower()) | |
{ | |
count = htmlContainerControl.Controls.Count; | |
} | |
} | |
} | |
return count; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment