Here is what I have so far. It worked with the first 5 values but as I added more and it got more complicated it has flaws in it.
Some pointers or direction would be appreciated.
Thanks,
Code:
@ Page Language="C#" Debug="True" %>
<html>
<head>
<title>Group Test</title>
</head>
<body>
<script language="C#" runat="server">
void Page_Load()
{
string Html = "";
string [] PageIds = new string[10]{"1","2","3","4","5","6","7","8","9","10"};
string [] PageNames = new string[10]{"Homepage","About Me","Articles","Downloads","Contact Me","page6","page7","page8","page9","page10"};
string [] ParentPages = new string[10]{"root","1","4","root","2","root","root","6","7","7"};
int i;
int j;
int lvl;
int indent;
int currentJ;
string currentPage = "";
bool finished = false;
for(i=0;i<PageIds.Length;i++)
{
lvl = 1;
indent = 0;
if(ParentPages[i] == "root")
{
finished = false;
Html += "\n\t\t<div style='width:"+indent+"px;float:left'></div>" + PageNames[i] + "<br>";
currentPage = PageIds[i];
while(!finished)
{
finished = true;
for(j=0;j<PageIds.Length;j++)
{
if(currentPage == ParentPages[j])
{
lvl++;
indent += 20;
currentJ = j;
currentPage = PageIds[currentJ];
Html += "\n\t\t\t<div style='width:"+indent+"px;float:left'></div>" +
PageNames[currentJ] + "<br>";
}
}
for(j=0;j<PageIds.Length;j++)
{
if(ParentPages[j] == currentPage)
{
finished = false;
}
}
}
}
}
Output.Text = Html;
}
</script>
<form runat="server">
<asp:Label id="Output" runat="server" />
</form>
</body>
</html>