我在我的网站上使用rad菜单(telerik)。菜单项绑定到后面的代码中的菜单。我从数据库中获取导航网址,导航网址有时候会像JavaScript
一样
js=OpenSupportWin();
而不是页面网址 因此,当我给这个导航时,没有任何事情发生。请帮我解决这个问题。
private void GenerateVerticalMenuTelerik(string pParentMenuId, RadMenuItem rmi)
{
List<DBMenus> ListVerticalMenus = new List<DBMenus>();
ListVerticalMenus = MenuGenerator.GetVerticalMainMenusFromNode(pParentMenuId, ClsLogin.Instance.IsAuthenticated());
if (ListVerticalMenus != null)
{
foreach (DBMenus asVertical in ListVerticalMenus)
{
try
{
bool IsSelectedVertical = (m_SelectedMenuPath.SelectedSubItemId == asVertical.SiteMapNodeId);
RadMenuItem rmItem = new RadMenuItem();
rmItem.Text = asVertical.WORDINGTextTitle;
rmItem.NavigateUrl = PII.ToolWeb.Tools.pkFunctions.GetPageLinkURL(asVertical.SiteMapNodeUrl);
rmi.Items.Add(rmItem);
}
catch (Exception ex)
{
}
}
}
}
答案 0 :(得分:0)
string url js = as Vertical.SiteMapNode Url;
if (url_js.Contains("js"))
{
url_js = url_js.Replace("?js=", "");
url_js = url_js.Replace(";", "");
url_js = "javascript:" + url_js;
}
我写了这些代码行,它对我有用
答案 1 :(得分:-1)
将navigateUrl设置为以下内容:
item.NavigateUrl = "javascript:OpenSupportWin();";