Reputation: 803
I am using aspx for my template in kentico with a CMSListMenu. The CMSListMenu is like this:
<cms:CMSListMenu CssClass="sm sm-blue" ID="main_menu" Path="/%"
runat="server" ClassNames="CMS.MenuItem" />
I want it to return something like this:
<ul class="sm sm-blue" ID="main_menu">
<li>Home</li>
<li>About Us</li>
<li>Products</li>
</ul>
How can I achieve this?
Upvotes: 1
Views: 305
Reputation: 4086
I tend to ignore the built-in web-parts in Kentico for lists. Rather using the <cms:CMSRepeater>
and a transformation. The CMSRepeater
is analogous to asp.net's <asp:Repeater>
control, with the added access to the Kentico CMS tree structure.
So a deceleration of the CMSRepeater
in code would look like:
<cms:CMSRepeater ClassNames="CMS.MenuItem" Path="/%" runat="server" >
<HeaderTemplate>
<ul class="sm sm-blue" id="main_menu">
</HeaderTemplate>
<ItemTemplate>
<li><%# Eval("DocumentName") %></li> <!-- Or whatever column you need to extract for the title-->
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</cms:CMSRepeater>
Alternately if you create the CMSRepeater
web part in the CMS UI, you can set up the list header/footer directly in the dialog,
and point to a Transformation for a Document Type. The transformation is a separate file, and will contain the same scope as the content within <ItemTemplate>
above.
Upvotes: 1