That menu is created by when u create new page. that page should be added to menu list automatically. I tried to get cookie value like that - ( here we are some coding -
private void MenuList()
{
List
List
List
List
string strMenu = string.Empty;
if (menu_list.Count > 0)
{
for (int i = 0; i < menu_list.Count; i++)
{
if (menu_list[i].ParentID == Guid.Empty)
{
// find second level menu
Second_list = GetSubMenu(menu_list, menu_list[i].MenuID);
// print out the first level with
if (Second_list.Count > 0)
{
string strSecondLevel = string.Empty;
//print out the first level
//strMenu += "
strMenu += "
HttpCookie MyCookie = HttpContext.Current.Request.Cookies["menu"];
if (MyCookie == null)
{
MyCookie = new HttpCookie("menu");
}
// open the second level
strMenu += "
- ";
- tag
//strMenu += " - " + Second_list[j].Name + "";
strMenu += " - " + Second_list[j].Name + "";
// open the third level
strMenu += "- ";
- " + m3.Name + " ";
- " + m3.Name + " ";
foreach (Menus m3 in Third_list)
{
// print out the third level
//strMenu = "
strMenu = "
//remove third level menu from the main list
for (int c = 0; c < menu_list.Count; c++)
{
if (m3.MenuID == menu_list[c].MenuID)
{
menu_list.RemoveAt(c);
i--;
}
}
}
//close the third level
strMenu += "
//close the second level
strMenu += "
for (int j = 0; j < Second_list.Count; j++)
{
//remove second level list from main list
for (int count = 0; count < menu_list.Count; count++)
{
if (Second_list[j].MenuID == menu_list[count].MenuID)
{
menu_list.RemoveAt(count);
i--;
}
}
// find third level menu
Third_list = GetSubMenu(menu_list, Second_list[j].MenuID);
if (Third_list.Count > 0)
{
// print out the second level without closing
// close the first level
strMenu += "
int index2 = Second_list.IndexOf(Second_list[j]);
Second_list.InsertRange(index2 + 1, Third_list);
}
else
{
// print out the second level
for (int m = 0; m < Second_list.Count; m++)
{
//strMenu += "
strMenu += "
}
// close the second level
strMenu += "";
// close the first level
strMenu += "";
int index1 = menu_list.IndexOf(menu_list[i]);
menu_list.InsertRange(index1 + 1, Second_list);
}
}
}
else
{
//strMenu += "
strMenu += "
}
}
}
navigationMenuList.InnerHtml = strMenu;
}
}
In above code has bold sentence. that sentece is trying to get cookie value from anchor tag on click event. I have no idea yet. :( BAD Day
No comments:
Post a Comment