ASPX templates
Version 5.x > ASPX templates > SelectNodes Multiple ClassNames Order View modes: 
User avatar
Certified Developer v7
Certified  Developer v7
adam-syndicut - 11/19/2010 3:59:54 AM
   
SelectNodes Multiple ClassNames Order
Using this code to build my navigation
CMS.TreeEngine.TreeProvider tree = new CMS.TreeEngine.TreeProvider();
tree.MergeResults = true;
DataSet menu = tree.SelectNodes(CMSContext.CurrentSiteName, "/%", CMSContext.PreferredCultureCode, true, "CMS.MenuItem;CMS.Blog;quiller.specialisms", "DocumentMenuItemHideInNavigation = 0", "NodeLevel,NodeOrder");


problem is it pulling out all the cms.menuitem pages and then the cms.blog pages.

e.g order should be

Home | Abouts Us | Blog | Contact

but it pulling out in this order

Home | About us | Contact | Blog

i've looked at that tree.sortmergedResults but nothing seems to work.

Any ideas ?


User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 11/22/2010 7:16:29 AM
   
RE:SelectNodes Multiple ClassNames Order
Hi,

you can use uniView control in combination with GroupedDataSource to create your custom menu:


//Create DataSet containing all menu item documents in the system
DataSet ds = TreeHelper.SelectNodes("/%", false, "CMS.MenuItem", "", "NodeLevel, NodeOrder", -1, true);


//Check that the DataSet isn't empty
if (!DataHelper.DataSourceIsEmpty(ds))
{
//Create GroupedDataSource from the ds DataSet
GroupedDataSource gpd = new GroupedDataSource(ds, "NodeParentID", "NodeLevel");

//Set RelationColumnID property of the UniView control
this.UniView1.RelationColumnID = "NodeID";

//Bind the DataSet to the UniView control
this.UniView1.DataSource = gpd;

this.UniView1.DataBind();
}




<cms:UniView ID="UniView1" runat="server">
<%-- UniView templates ----------------------------------------------------------------- --%>
<itemtemplate>
<%# HTMLHelper.HTMLEncode( Convert.ToString(Eval("NodeAliasPath"))) %>
</itemtemplate>
<alternatingitemtemplate>
<font color="#999999"><%# HTMLHelper.HTMLEncode( Convert.ToString(Eval("NodeAliasPath"))) %>
</font>
</alternatingitemtemplate>
<separatortemplate>
</li>
<li>
</separatortemplate>
<headertemplate>
<ul>
<li>
</headertemplate>
<footertemplate>
</li>
</ul>
</footertemplate>
<%-- UniView templates ------------------------------------------------------------------ --%>
</cms:UniView>


Best regards,
Ivana Tomanickova

User avatar
Certified Developer v7
Certified  Developer v7
adam-syndicut - 11/22/2010 10:02:20 AM
   
RE:SelectNodes Multiple ClassNames Order
don't want to use uniview, i'm using a telerik radmenu. i've checked the sql and they both pull back and contain fields for nodeorder and nodelevel, its just ignoring them. thought this was the whole point of being able to add multiple classnames so you can manipulate them as one collection.

must be an easy solution

will look into the GroupedDataSource

User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 12/6/2010 5:27:42 AM
   
RE:SelectNodes Multiple ClassNames Order
Hi,

have you created telerik menu successfully? Following knowledge base article could be useful for you:
Integrating 3th party components

Best regards,
Ivana Tomanickova