Change Order of SPNavigationNode Children
-
2012年4月11日 下午 09:58
Hi All ,
I am trying to add SPNavigationNode programatically and it is adding sucessfully where as it not taking the order which I mention , below is the sample code , can any body suggest how to go about the same .
SPNavigationNodeCollection navigationNodes = SPWeb.Navigation.TopNavigationBar;
SPNavigationNode oParentNodeToAdd = navigationNodes.Navigation.GetNodeByUrl("URL");
SPNavigationNode oPrevNode = navigationNodes.Navigation.GetNodeByUrl("URL");
SPNavigationNode oNode = new SPNavigationNode("Title", "URL");
oParentNodeToAdd.Children.Add(oNode, oPrevNode);
oNode.Update();Regards
Srujan.N
srujan
所有回覆
-
2012年4月11日 下午 10:13.Add() adds oNode before oPrevNode. If you need to change the order, you may try SPNavigationNode.Move(collection, previousSibling).
Xiang Zeng
-
2012年4月16日 下午 03:54
Hi ,
I tired .Add() but it didnt work , I deleted required nodes and added in required order and it was sucessfull .
Regards
Srujan.N
srujan
- 已標示為解答 Qiao WeiMicrosoft Contingent Staff, Moderator 2012年4月19日 上午 09:35

