/// <summary> /// Expands the issue paths. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.Web.SiteMapResolveEventArgs"/> instance containing the event data.</param> /// <returns></returns> private SiteMapNode ExpandIssuePaths(Object sender, SiteMapResolveEventArgs e) { if (SiteMap.CurrentNode == null) { return(null); } var currentNode = SiteMap.CurrentNode.Clone(true); var tempNode = currentNode; // The current node, and its parents, can be modified to include // dynamic query string information relevant to the currently // executing request. var title = (TitleTextBox.Text.Length >= 30) ? TitleTextBox.Text.Substring(0, 30) + " ..." : TitleTextBox.Text; tempNode.Title = string.Format("{0}: {1}", lblIssueNumber.Text, title); tempNode.Url = string.Concat(tempNode.Url, "?id=", IssueId); if ((null != (tempNode = tempNode.ParentNode))) { tempNode.Url = string.Format("~/Issues/IssueList.aspx?pid={0}", ProjectId); } return(currentNode); }
SiteMapNode SmartSiteMapProvider_SiteMapResolve(object sender, SiteMapResolveEventArgs e) { if (SiteMap.CurrentNode == null) { return(null); } SiteMapNode temp; temp = SiteMap.CurrentNode.Clone(true); Uri u = new Uri(e.Context.Request.Url.ToString()); SiteMapNode tempNode = temp; while (tempNode != null) { string qs = GetReliance(tempNode, e.Context); if (qs != null) { if (tempNode != null) { tempNode.Url += qs; } } tempNode = tempNode.ParentNode; } return(temp); }
public SiteMapNode SiteMapResolve(object sender, SiteMapResolveEventArgs e) { if (SiteMap.CurrentNode != null) { SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); SiteMapNode tempNode = currentNode; tempNode.Title = _currentForum.Subject.CleanForumCodeTags(); if (_currentForum.ModerationLevel != (int)Enumerators.Moderation.UnModerated) { tempNode.Title += String.Format(" ({0})", EnumHelper.GetDescription((Enumerators.Moderation)_currentForum.ModerationLevel)); } if (_archiveView == 1) { tempNode.Title += " (Archived)"; } else if (_currentForum.Status == (int)Enumerators.PostStatus.Closed) { tempNode.Title += webResources.ForumIsLocked; } return(currentNode); } return(null); }
/// <summary> /// 当访问CurrentNode属性时发生. /// </summary> /// <param name="sender"> /// 事件源, SiteMapProvider类的实例. /// </param> /// <param name="e"> /// 包含事件数据的SiteMapResolveEventArgs. /// </param> /// <returns> /// 表示SiteMapResolveEventHandler处理结果的SiteMapNode. /// </returns> SiteMapNode SiteMap_SiteMapResolve(object sender, SiteMapResolveEventArgs e) { // 一次请求只执行一次. SiteMap.SiteMapResolve -= new SiteMapResolveEventHandler(SiteMap_SiteMapResolve); // 我们可以在此创建很多SiteMapNodes. SiteMapNode childNode = new SiteMapNode(SiteMap.Provider, "2"); childNode.Url = "/child.aspx"; childNode.Title = "子页面"; childNode.ParentNode = new SiteMapNode(SiteMap.Provider, "1"); childNode.ParentNode.Url = "/root.aspx"; childNode.ParentNode.Title = "根页面"; // 我们也可以关联动态节点到已有的站点地图. SiteMapNode nodeFromSiteMap = GetSiteMapNode("item"); if (nodeFromSiteMap != null) { childNode.ParentNode.ParentNode = nodeFromSiteMap; } // 在breadcrumb中使用已被修改的项. return(childNode); }
/// <summary> /// Expands the issue paths. /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="System.Web.SiteMapResolveEventArgs"/> instance containing the event data.</param> /// <returns></returns> private SiteMapNode ExpandIssuePaths(Object sender, SiteMapResolveEventArgs e) { if (SiteMap.CurrentNode != null) { var currentNode = SiteMap.CurrentNode.Clone(true); var tempNode = currentNode; // The current node, and its parents, can be modified to include // dynamic query string information relevant to the currently // executing request. if (ProjectId != 0) { tempNode.Url = string.Format("{0}?id={1}", tempNode.Url, ProjectId); } if ((null != (tempNode = tempNode.ParentNode))) { tempNode.Url = string.Format("~/Queries/QueryList.aspx?pid={0}", ProjectId); } return(currentNode); } return(null); }
/// <summary> /// Occurs when the CurrentNode property is accessed. /// </summary> /// <param name="sender"> /// The source of the event, an instance of the SiteMapProvider class. /// </param> /// <param name="e"> /// A SiteMapResolveEventArgs that contains the event data. /// </param> /// <returns> /// The SiteMapNode that represents the result of the SiteMapResolveEventHandler operation. /// </returns> SiteMapNode SiteMap_SiteMapResolve(object sender, SiteMapResolveEventArgs e) { // Only need one execution in one request. SiteMap.SiteMapResolve -= new SiteMapResolveEventHandler(SiteMap_SiteMapResolve); // We can dynamically create many SiteMapNodes here. SiteMapNode childNode = new SiteMapNode(SiteMap.Provider, "2"); childNode.Url = "/child.aspx"; childNode.Title = "child"; childNode.ParentNode = new SiteMapNode(SiteMap.Provider, "1"); childNode.ParentNode.Url = "/root.aspx"; childNode.ParentNode.Title = "root"; // Also we can associate the dynamic nodes with the existent site map. SiteMapNode nodeFromSiteMap = GetSiteMapNode("item"); if (nodeFromSiteMap != null) { childNode.ParentNode.ParentNode = nodeFromSiteMap; } // Use the new SiteMapNode in the breadcrumb. return(childNode); }
private void ChangeCategoryMap(SiteMapResolveEventArgs e, SiteMapNode currentNode) { try { SiteMapNode tempNode = currentNode; Category category = CategoryManager.GetCategoryByID(CategoryId); if (0 != CategoryId) { tempNode.Url = SEOHelper.GetCategoryURL(category.CategoryID); CategoryCollection categCollection = CategoryManager.GetBreadCrumb(category.CategoryID); string categoryPath = categCollection.Aggregate(String.Empty, (current, c) => current + String.Format( String.IsNullOrEmpty(current) ? "{0}" : "/{0}", c.Name)); tempNode.Title = categoryPath; tempNode.Description = categoryPath; } } catch { } }
static SiteMapNode HideRootNode(Object sender, SiteMapResolveEventArgs e) { // // Hide the root node from SiteMapPath controls by cloning the site // map from the current node up to the node below the root node and // setting that node's ParentNode property to null. // if (SiteMap.CurrentNode == null) { return(null); } SiteMapNode node = SiteMap.CurrentNode.Clone(); SiteMapNode current = node; SiteMapNode root = SiteMap.RootNode; if (current != root) // Just in case the current node *is* the root node! { while (node.ParentNode != root) { node.ParentNode = node.ParentNode.Clone(); node = node.ParentNode; } node.ParentNode = null; } return(current); }
private SiteMapNode ExpandForumPaths(Object sender, SiteMapResolveEventArgs e) { SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); SiteMapNode tempNode = currentNode; tempNode.Url = "Some"; return(currentNode); }
private SiteMapNode ModifyPath(object sender, SiteMapResolveEventArgs e) { // 克隆当前结点和父节点 SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); // 创建新节点 SiteMapNode newNode = new SiteMapNode(e.Provider, "FAQ", "OthrePage.aspx", "FAQ"); newNode.ParentNode = currentNode; currentNode = newNode; return currentNode; }
SiteMapNode SiteMap_SiteMapResolve(object sender, SiteMapResolveEventArgs e) { SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); if (currentNode != null) { currentNode.Title = CurrentInstance.Name; } return(currentNode); }
private SiteMapNode Provider_SiteMapResolve(object sender, SiteMapResolveEventArgs e) { if (e.Context.CurrentHandler is ISiteMapResolver) { return(((ISiteMapResolver)e.Context.CurrentHandler).SiteMapResolve(sender, e)); } else { return(null); } }
SiteMapNode SiteMap_SiteMapResolve(object sender, SiteMapResolveEventArgs e) { SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); SiteMapNode tempNode = currentNode; tempNode = tempNode.ParentNode; if ((tempNode != null) && (SupplierId != null)) { tempNode.Url = string.Format("{0}?{1}={2}", tempNode.Url, SupplierManager.QrySupplierId, SupplierId); } return(currentNode); }
public SiteMapNode SiteMapResolve(object sender, SiteMapResolveEventArgs e) { if (SiteMap.CurrentNode != null) { SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); SiteMapNode tempNode = currentNode; tempNode.Title = _profileUser; return(currentNode); } return(null); }
// The Sitemap resolve event is handed over to the current page being processed. private SiteMapNode SiteMapResolveHandler(object sender, SiteMapResolveEventArgs e) { var pageBase = e.Context.CurrentHandler as PageBase; if (pageBase != null) { return(pageBase.SiteMapResolve(sender, e)); } else { return(null); } }
// returns custom breadcrumb chain for this page. public override SiteMapNode SiteMapResolve(object sender, SiteMapResolveEventArgs e) { var home = new SiteMapNode(e.Provider, "Home", "~/", "home"); var shopping = new SiteMapNode(e.Provider, "Shopping", "~/shop", "shopping"); var products = new SiteMapNode(e.Provider, "Products", "~/shop/products", "product catalog"); var product = new SiteMapNode(e.Provider, "Product", null, "product details"); shopping.ParentNode = home; products.ParentNode = shopping; product.ParentNode = products; return(product); }
/// <summary> /// Override. Returns custom breadcrumb chain for this page. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <returns></returns> public override SiteMapNode SiteMapResolve(object sender, SiteMapResolveEventArgs e) { var home = new SiteMapNode(e.Provider, "Home", "~/", "home"); var admin = new SiteMapNode(e.Provider, "Admin", "~/admin", "administration"); var customers = new SiteMapNode(e.Provider, "Customers", "~/admin/customers", "customers"); var customer = new SiteMapNode(e.Provider, "Customer", null, "customer details"); admin.ParentNode = home; customers.ParentNode = admin; customer.ParentNode = customers; return(customer); }
// returns custom breadcrumb chain for this page. public override SiteMapNode SiteMapResolve(object sender, SiteMapResolveEventArgs e) { var home = new SiteMapNode(e.Provider, "Home", "~/", "home"); var admin = new SiteMapNode(e.Provider, "Admin", "~/admin", "administration"); var orders = new SiteMapNode(e.Provider, "Orders", "~/admin/members/orders", "orders"); var member = new SiteMapNode(e.Provider, "Orders", null, "member orders"); admin.ParentNode = home; orders.ParentNode = admin; member.ParentNode = orders; return(member); }
SiteMapNode SiteMap_SiteMapResolve(object sender, SiteMapResolveEventArgs e) { SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); SiteMapNode tempNode = currentNode; tempNode.Title = ucProduct.CurrentInstance.Name; tempNode = tempNode.ParentNode; if ((tempNode != null) && (ucProduct.CurrentInstance.SupplierId != null)) { tempNode.Title = ucProduct.CurrentInstance.SupplierName; tempNode.Url = string.Format("{0}?{1}={2}", tempNode.Url, SupplierPage.QryInstanceId, ucProduct.CurrentInstance.SupplierId); } return(currentNode); }
private SiteMapNode SiteMapResolve(object sender, SiteMapResolveEventArgs e) { var currentNode = e.Provider.CurrentNode.Clone(true); if (currentNode.Url.EndsWith("/managep.aspx")) currentNode.ParentNode.Url += e.Context.Request["cc"]; else if (currentNode.Url.EndsWith("/SenderProperties.aspx")) { uint firmCode; using (var connection = new MySqlConnection(Literals.GetConnectionString())) { connection.Open(); var command = new MySqlCommand(@" select firmcode from ordersendrules.order_send_rules osr where osr.id = ?ruleId ", connection); command.Parameters.AddWithValue("?RuleId", e.Context.Request["RuleId"]); firmCode = Convert.ToUInt32(command.ExecuteScalar()); } currentNode.ParentNode.Url += "?cc=" + firmCode; currentNode.ParentNode.ParentNode.Url += firmCode; } else if (currentNode.Url.EndsWith("/EditRegionalInfo.aspx")) { uint firmCode; using (var connection = new MySqlConnection(Literals.GetConnectionString())) { connection.Open(); var command = new MySqlCommand(@" SELECT FirmCode FROM usersettings.regionaldata rd WHERE RowID = ?Id", connection); command.Parameters.AddWithValue("?Id", Convert.ToUInt32(e.Context.Request["id"])); firmCode = Convert.ToUInt32(command.ExecuteScalar()); } currentNode.ParentNode.Url += "?cc=" + firmCode; currentNode.ParentNode.ParentNode.Url += firmCode; } else if (currentNode.Url.EndsWith("/managecosts.aspx")) { uint firmCode; using (var connection = new MySqlConnection(Literals.GetConnectionString())) { connection.Open(); var command = new MySqlCommand(@" SELECT FirmCode FROM usersettings.PricesData pd WHERE PriceCode = ?Id", connection); command.Parameters.AddWithValue("?Id", Convert.ToUInt32(e.Context.Request["pc"])); firmCode = Convert.ToUInt32(command.ExecuteScalar()); } currentNode.ParentNode.Url += "?cc=" + firmCode; currentNode.ParentNode.ParentNode.Url += firmCode; } return currentNode; }
private SiteMapNode AppendQueryString(object sender, SiteMapResolveEventArgs e) { if (SiteMap.CurrentNode != null) { SiteMapNode temp = SiteMap.CurrentNode.Clone(true); Uri u = new Uri(e.Context.Request.Url.ToString()); temp.Url = temp.Url + u.Query; if (temp.ParentNode != null) temp.ParentNode.Url = temp.ParentNode.Url + u.Query; return temp; } else return null; }
public SiteMapNode SiteMapResolve(object sender, SiteMapResolveEventArgs e) { if (SiteMap.CurrentNode == null) { return(null); } SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); SiteMapNode tempNode = currentNode; switch (_action) { case "topic": tempNode.Title = Resources.webResources.lblNewTopic; tempNode = tempNode.ParentNode; if (ForumId != null) { tempNode.Title = _forum.Subject; tempNode.Url = "~/Content/Forums/forum.aspx?FORUM=" + ForumId; } break; case "reply": case "quote": TextInfo textInfo = CultureInfo.CurrentCulture.TextInfo; tempNode.Title = HttpUtility.HtmlDecode(_thisTopic.Subject) + " (" + textInfo.ToTitleCase(_action) + ")"; tempNode = tempNode.ParentNode; tempNode.Title = string.Format("{0}", _thisTopic.Forum.Subject); tempNode.Url = "~/Content/Forums/topic.aspx?TOPIC=" + _thisTopic.Id; break; case "edit": switch (_type) { case "reply": tempNode.Title = Resources.webResources.lblEditReply; break; case "topics": tempNode.Title = Resources.webResources.lblEditTopic + " " + HttpUtility.HtmlDecode(_thisTopic.Subject); break; } tempNode = tempNode.ParentNode; tempNode.Title = string.Format("{0}", _thisTopic.Forum.Subject); tempNode.Url = "~/Content/Forums/topic.aspx?TOPIC=" + _thisTopic.Id; break; } //HttpUtility.HtmlDecode(_thisTopic.Subject) return(currentNode); }
private static SiteMapNode ExpandIssuePaths(Object sender, SiteMapResolveEventArgs e) { if (SiteMap.CurrentNode == null) { return(null); } var currentNode = SiteMap.CurrentNode.Clone(true); var tempNode = currentNode; if ((null != (tempNode = tempNode.ParentNode))) { tempNode.Url = string.Empty; } return(currentNode); }
/// <summary> /// 当访问CurrentNode属性时发生. /// </summary> /// <param name="sender"> /// 事件源, SiteMapProvider类的实例. /// </param> /// <param name="e"> /// 包含事件数据的SiteMapResolveEventArgs. /// </param> /// <returns> /// 表示SiteMapResolveEventHandler处理结果的SiteMapNode. /// </returns> SiteMapNode SiteMap_SiteMapResolve(object sender, SiteMapResolveEventArgs e) { // 一次请求只执行一次. SiteMap.SiteMapResolve -= new SiteMapResolveEventHandler(SiteMap_SiteMapResolve); if (SiteMap.CurrentNode != null) { // SiteMap.CurrentNode是只读的,因此我们必须复制一份进行操作. SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); currentNode.Title = Request.QueryString["name"]; // 在breadcrumb中使用已被修改的项. return(currentNode); } return(null); }
/// <summary> /// Occurs when the CurrentNode property is accessed. /// </summary> /// <param name="sender"> /// The source of the event, an instance of the SiteMapProvider class. /// </param> /// <param name="e"> /// A SiteMapResolveEventArgs that contains the event data. /// </param> /// <returns> /// The SiteMapNode that represents the result of the SiteMapResolveEventHandler operation. /// </returns> SiteMapNode SiteMap_SiteMapResolve(object sender, SiteMapResolveEventArgs e) { // Only need one execution in one request. SiteMap.SiteMapResolve -= new SiteMapResolveEventHandler(SiteMap_SiteMapResolve); if (SiteMap.CurrentNode != null) { // SiteMap.CurrentNode is readonly, so we need to clone one to operate. SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); currentNode.Title = Request.QueryString["name"]; // Use the changed one in the breadcrumb. return(currentNode); } return(null); }
private SiteMapNode ExpandPaths(Object sender, SiteMapResolveEventArgs e) { if (SiteMap.CurrentNode == null) { return(null); } var currentNode = SiteMap.CurrentNode.Clone(true); var tempNode = currentNode; if ((null != (tempNode = tempNode.ParentNode))) { tempNode.Url = string.Format("~/Issues/IssueList.aspx?pid={0}", ProjectId); } return(currentNode); }
/// <summary> /// Override. Returns custom breadcrumb chain for this page. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <returns></returns> public override SiteMapNode SiteMapResolve(object sender, SiteMapResolveEventArgs e) { var home = new SiteMapNode(e.Provider, "Home", "~/", "home"); var admin = new SiteMapNode(e.Provider, "Admin", "~/admin", "administration"); var orders = new SiteMapNode(e.Provider, "Orders", "~/admin/customers/orders", "orders"); var customerId = Page.RouteData.Values["customerid"].ToString(); var customer = new SiteMapNode(e.Provider, "Customer", "~/admin/customers/" + customerId + "/orders", "customer orders"); var details = new SiteMapNode(e.Provider, "Details", null, "line items"); admin.ParentNode = home; orders.ParentNode = admin; customer.ParentNode = orders; details.ParentNode = customer; return(details); }
private SiteMapNode SiteMap_SiteMapResolve(object sender, SiteMapResolveEventArgs e) { if (SiteMap.CurrentNode == null) { String url = e.Context.Request.RawUrl; if (url.Contains("TheLoai/")) { CategoryModel categoryLogic = new CategoryModel(); String parentNodeTitle = "Thể Loại"; String subNodeAlias = url.Substring(url.IndexOf("TheLoai") + 8); String subNodeTitle = categoryLogic.GetCategoryNameByAlias(subNodeAlias).Name; SiteMapNode parentNode = new SiteMapNode(e.Provider, url.Substring(0, 8), null, parentNodeTitle); SiteMapNode childNode = new SiteMapNode(e.Provider, url, null, subNodeTitle); parentNode.ParentNode = SiteMap.RootNode; childNode.ParentNode = parentNode; return(childNode); } else if (url.Contains("TaiLieu/")) { DocumentModel docLogic = new DocumentModel(); String parentNodeTitle = "Tài Liệu"; String[] DocFullName = url.Substring(url.IndexOf("TaiLieu") + 8).Split('-'); String subNodeAlias = DocFullName[1]; String subNodeTitle = docLogic.GetDocumentById(Int32.Parse(DocFullName[0])).Name; SiteMapNode parentNode = new SiteMapNode(e.Provider, url.Substring(0, 8), null, parentNodeTitle); SiteMapNode childNode = new SiteMapNode(e.Provider, url, null, subNodeTitle); parentNode.ParentNode = SiteMap.RootNode; childNode.ParentNode = parentNode; return(childNode); } bool IsHomePage = url.Contains("default.aspx") || url == "/"; if (IsHomePage) { SiteMapNode node = new SiteMapNode(e.Provider, url, url, "Trang Chủ"); return(node); } } return(SiteMap.CurrentNode); }
public SiteMapNode SiteMapResolve(object sender, SiteMapResolveEventArgs e) { string category = ""; string question = ""; SiteMapNode currentNode = null; if (SiteMap.CurrentNode == null) { var routable = e.Context.CurrentHandler as IRoutablePage; if (routable != null) { var rc = routable.Routing.RequestContext; var route = rc.RouteData.Route; var segments = route.GetVirtualPath(rc, null).VirtualPath.Split('/'); var path = "~/" + string.Join("/", segments.Take(segments.Length - rc.RouteData.Values.Count).ToArray()); category = segments[1]; question = segments[2]; var findSiteMapNodeFromKey = SiteMap.Provider.FindSiteMapNodeFromKey(@"~\question"); if (findSiteMapNodeFromKey != null) { currentNode = findSiteMapNodeFromKey.Clone(true); } } } if (SiteMap.CurrentNode != null) { currentNode = SiteMap.CurrentNode.Clone(true); currentNode.Url = @"~\Faq"; } SiteMapNode tempNode = currentNode; if (category != "") { tempNode.Title = category + " : " + question.Replace("_", " "); } //tempNode = tempNode.ParentNode; ////tempNode.Title = question; //tempNode.Url = tempNode.Url; return(currentNode); }
protected static SiteMapNode ResolveIds(Object sender, SiteMapResolveEventArgs e) { /*SiteMapProvider prov = (SiteMapProvider)sender; * SiteMapNode nn = prov.FindSiteMapNode( HttpContext.Current ); * nn = nn.Clone( true ); * nn.Url += "_ppp";*/ AlbumMasterPage pg = ((Page)HttpContext.Current.Handler).Master as AlbumMasterPage; if (pg == null) { return(e.Provider.FindSiteMapNode(HttpContext.Current)); } else { return(pg.GetCurrNode()); } }
protected SiteMapNode ExpandForumPath(Object sender, SiteMapResolveEventArgs e) { SiteMapNode currentNode = e.Provider.CurrentNode.Clone(true); if (currentNode.Key.EndsWith("/reports/reportproperties.aspx", StringComparison.OrdinalIgnoreCase)) { if (!String.IsNullOrEmpty(e.Context.Request["TemporaryId"])) { SiteMapNode _temporaryNode = e.Provider.FindSiteMapNode("~/Reports/TemporaryReport.aspx"); currentNode = _temporaryNode.ChildNodes[0].Clone(true); currentNode.ParentNode.Url += "?TemporaryId=" + e.Context.Request["TemporaryId"]; } else { currentNode.ParentNode.Url += "?r=" + e.Context.Request["r"]; } } if (currentNode.Key.EndsWith("/reports/reportpropertyvalues.aspx", StringComparison.OrdinalIgnoreCase)) { if (!String.IsNullOrEmpty(e.Context.Request["TemporaryId"])) { SiteMapNode _temporaryNode = e.Provider.FindSiteMapNode("~/Reports/TemporaryReport.aspx"); //Здесь это делается не совсем корректно. currentNode = _temporaryNode.ChildNodes[0].ChildNodes[0].Clone(true); currentNode.ParentNode.ParentNode.Url += "?TemporaryId=" + e.Context.Request["TemporaryId"]; currentNode.ParentNode.Url += e.Context.Request["TemporaryId"] + "&rp=" + e.Context.Request["rp"]; } else { currentNode.ParentNode.Url += "?r=" + e.Context.Request["r"] + "&rp=" + e.Context.Request["rp"]; } } if (currentNode.Key.EndsWith("/reports/temporaryreportschedule.aspx", StringComparison.OrdinalIgnoreCase)) { currentNode.ParentNode.ParentNode.Url += "?TemporaryId=" + e.Context.Request["TemporaryId"]; Report _temporaryReport = Report.FindFirst( Expression.Eq("GeneralReport", GeneralReport.Find(Convert.ToUInt64(e.Context.Request["TemporaryId"])))); currentNode.ParentNode.Url += e.Context.Request["TemporaryId"] + "&rp=" + _temporaryReport.Id; } return(currentNode); }
/// <summary> /// Occurs when the CurrentNode property is accessed. /// </summary> /// <param name="sender"> /// The source of the event, an instance of the SiteMapProvider class. /// </param> /// <param name="e"> /// A SiteMapResolveEventArgs that contains the event data. /// </param> /// <returns> /// The SiteMapNode that represents the result of the SiteMapResolveEventHandler operation. /// </returns> SiteMapNode SiteMap_SiteMapResolve(object sender, SiteMapResolveEventArgs e) { // Only need one execution in one request. SiteMap.SiteMapResolve -= new SiteMapResolveEventHandler(SiteMap_SiteMapResolve); if (SiteMap.CurrentNode != null) { // SiteMap.CurrentNode is readonly, so we need to clone one to operate. SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); currentNode.Title = Request.QueryString["name"]; currentNode.ParentNode.Title = Database.GetCategoryByItem(Request.QueryString["name"]); currentNode.ParentNode.Url = "/Category.aspx?name=" + Database.GetCategoryByItem(Request.QueryString["name"]); // Use the changed one in the Breadcrumb. return(currentNode); } return(null); }
private SiteMapNode ModifyPath(object sender, SiteMapResolveEventArgs e) { // 克隆当前结点和父节点 SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); // 创建新节点 int id = Convert.ToInt32(Request["PlanClassifyID"].Trim()); string nodeName; switch (id) { case 1: nodeName = "创意征集计划"; break; case 2: nodeName = "立项计划"; break; case 3: nodeName = "市场化计划"; break; default: nodeName = "创意征集计划"; break; } SiteMapNode newNode = new SiteMapNode(e.Provider, nodeName, "OthrePage.aspx", nodeName); newNode.ParentNode = currentNode; currentNode = newNode; return currentNode; }
//http://msdn.microsoft.com/en-us/library/system.web.sitemap.sitemapresolve.aspx //solve > SiteMapNode is readonly, property Title cannot be modified. SiteMapNode SiteMap_SiteMapResolve(object sender, SiteMapResolveEventArgs e) { if (SiteMap.CurrentNode != null) { SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true); SiteMapNode tempNode = currentNode; tempNode = ReplaceNodeText(tempNode); return currentNode; } return null; }