ta5ae
-
3/29/2006 10:10:37 AM
Opening JavaScript Page (Menu item)s from search results
I found that opening Page (menu Items) which were of the type JavaScript did not work very well.
I use this option a lot to open links in a new window.
I did the following execute the JavaScript of the Page (Menu Item) instead or trying to navigate to the Page (Menu Item).
... const int JS_MENU_ITEM_TYPE = 3; const string SEARCH_PAGE_URL = "~/Search";
// JavaScript test TreeNode currentNode = tree.SelectSingleNode(redirectPath, TreePathTypeEnum.AliasPath, "cms.menuitem", true);
if (currentNode != null && currentNode.ClassName == "cms.menuitem" && (int) currentNode.GetValue("MenuItemType") == JS_MENU_ITEM_TYPE) { string jsCommand = (string) currentNode.GetValue("MenuItemJavaScript");
Response.Write("<script language='javascript'>" + jsCommand + ";document.location.href = '"+ ResolveUrl(SEARCH_PAGE_URL) + "'</script>"); } else if ( addExtension ) ...
Normally this will execute the JavaScript command and redirect the user to the search page a fresh.
Hope this is helpful to anyone who uses JS Page (Menu Item)s like I do.
|