I've looked around the forums and the DNN source, couldn't find a way to get the Panes for the non-active tab - If there is a way that I missed in my search, I'd like to know so I can use that instead. :)
Until then, I thought I'd share the function I wrote to do this.
protected ArrayList GetTabPanes(int TabID)
{
TabController tabController = new TabController();
TabInfo tabInfo = tabController.GetTab(TabID, 0, true);
string strSkinPath = "";
strSkinPath = tabInfo.SkinPath;
if (strSkinPath == null || strSkinPath == "")
{
strSkinPath = PortalSettings.DefaultPortalSkin;
}
switch (strSkinPath.ToLowerInvariant().Substring(0, 3))
{
case "[g]":
strSkinPath = Regex.Replace(strSkinPath, "\\[g]", Globals.HostMapPath, RegexOptions.IgnoreCase);
break;
case "[l]":
strSkinPath = Regex.Replace(strSkinPath, "\\[l]", PortalSettings.HomeDirectoryMapPath, RegexOptions.IgnoreCase);
break;
}
StreamReader sr = File.OpenText(strSkinPath);
string strSkinFile = sr.ReadToEnd();
Regex regEx = new Regex("(?<=<(td|div|span|p) )[^>]*((?<= runat=\"server\").*(?=>))", RegexOptions.IgnoreCase);
MatchCollection mc = regEx.Matches(strSkinFile);
ArrayList arrayList = new ArrayList();
Regex regExID = new Regex("(?<= ID=\").*?(?=\")", RegexOptions.IgnoreCase);
string strPane = "";
foreach (Match match in mc)
{
strPane = regExID.Match(match.Value).Value;
if (strPane.ToLowerInvariant() == "controlpanel" || strPane.ToLowerInvariant() == "") continue;
arrayList.Add(strPane);
}
return arrayList;
}
I'm not sure if this is 100% for all skins; It's VERY lightly tested, I just finished it up tonight and have only tested against DNN5 RC2 default skin. Yes, only tested in DNN5 RC2.
If anyone has any advice about this function, such as reducing to a single regex statement, code changes, feedback, ect, please post it, I'd love to hear it.
Note - Colorized code produced from http://puzzleware.net/CodeHtmler/default.aspx