The root is loading fine but I get just the last child item
Can anyone help me, please
public void Page_Init(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Do something resource-intensive that you only want to do on GETs
DataTable dtMenu = SplendidCache.TabMenu(); // Hide the tab menu if there is no menu to display.
// This should only occur during login.
if (dtMenu.Rows.Count == 0)
{
this.Visible = false;
return;
}
for (int nRow = 0, nDisplayedTabs = 0; nRow < dtMenu.Rows.Count; nRow++)
{
DataRow row = dtMenu.Rows[nRow];
string strModuleName = Sql.ToString(row["MODULE_NAME"]);
string strRelativePath = Sql.ToString(row["RELATIVE_PATH"]);
string strDisplayName = Server.HtmlEncode(L10n.Term(Sql.ToString(row["DISPLAY_NAME"]))); RadMenuItem child = new RadMenuItem();
child.Text = strDisplayName;
child.Value = strModuleName;
child.NavigateUrl = strRelativePath; SMGMenu.Items.Add(child); if (!String.IsNullOrEmpty(strModuleName))
{
ChildMenu(strModuleName, child);
}
}
SMGMenu.DataBind();
}
} public void ChildMenu(string parent, RadMenuItem menuItem)
{
DataTable dtShortcuts = SplendidCache.Shortcuts(parent);
RadMenuItem subChild = new RadMenuItem(); string strSubRelatedPath = String.Empty;
string strSubDisplayName = String.Empty;
string strSubModuleName = String.Empty; if (dtShortcuts.Rows.Count > 0)
{
foreach (DataRow rowShortcuts in dtShortcuts.Rows)
{
strSubRelatedPath = Sql.ToString(rowShortcuts["RELATIVE_PATH"]);
strSubDisplayName = Server.HtmlEncode(L10n.Term(Sql.ToString(rowShortcuts["DISPLAY_NAME"])));
strSubModuleName = Sql.ToString(rowShortcuts["MODULE_NAME"]); subChild.Text = strSubDisplayName;
subChild.Value = strSubModuleName;
subChild.NavigateUrl = strSubRelatedPath; if ((!String.IsNullOrEmpty(parent)) && (!String.IsNullOrEmpty(strSubModuleName)))
{
if (parent.ToLower() != strSubModuleName.ToLower())
{
ChildMenu(strSubModuleName, subChild);
}
}
menuItem.Items.Add(subChild);
}
SMGMenu.Items.Add(menuItem);
}
}
Can anyone help me, please
public void Page_Init(object sender, EventArgs e)
{
if (!IsPostBack)
{
// Do something resource-intensive that you only want to do on GETs
DataTable dtMenu = SplendidCache.TabMenu(); // Hide the tab menu if there is no menu to display.
// This should only occur during login.
if (dtMenu.Rows.Count == 0)
{
this.Visible = false;
return;
}
for (int nRow = 0, nDisplayedTabs = 0; nRow < dtMenu.Rows.Count; nRow++)
{
DataRow row = dtMenu.Rows[nRow];
string strModuleName = Sql.ToString(row["MODULE_NAME"]);
string strRelativePath = Sql.ToString(row["RELATIVE_PATH"]);
string strDisplayName = Server.HtmlEncode(L10n.Term(Sql.ToString(row["DISPLAY_NAME"]))); RadMenuItem child = new RadMenuItem();
child.Text = strDisplayName;
child.Value = strModuleName;
child.NavigateUrl = strRelativePath; SMGMenu.Items.Add(child); if (!String.IsNullOrEmpty(strModuleName))
{
ChildMenu(strModuleName, child);
}
}
SMGMenu.DataBind();
}
} public void ChildMenu(string parent, RadMenuItem menuItem)
{
DataTable dtShortcuts = SplendidCache.Shortcuts(parent);
RadMenuItem subChild = new RadMenuItem(); string strSubRelatedPath = String.Empty;
string strSubDisplayName = String.Empty;
string strSubModuleName = String.Empty; if (dtShortcuts.Rows.Count > 0)
{
foreach (DataRow rowShortcuts in dtShortcuts.Rows)
{
strSubRelatedPath = Sql.ToString(rowShortcuts["RELATIVE_PATH"]);
strSubDisplayName = Server.HtmlEncode(L10n.Term(Sql.ToString(rowShortcuts["DISPLAY_NAME"])));
strSubModuleName = Sql.ToString(rowShortcuts["MODULE_NAME"]); subChild.Text = strSubDisplayName;
subChild.Value = strSubModuleName;
subChild.NavigateUrl = strSubRelatedPath; if ((!String.IsNullOrEmpty(parent)) && (!String.IsNullOrEmpty(strSubModuleName)))
{
if (parent.ToLower() != strSubModuleName.ToLower())
{
ChildMenu(strSubModuleName, subChild);
}
}
menuItem.Items.Add(subChild);
}
SMGMenu.Items.Add(menuItem);
}
}