Pages - Menu

Kentico Prev Next navigation thru document

Just a quick dirt hack to get prev next working with a repeater webpart.

image6

Under transformation we will do this. (This particular case use the Blog document type)


   1: <p class="linked" <%# (Eval("DocumentNodeID").ToString() == CMSContext.CurrentDocument.GetValue("DocumentNodeID").ToString()) ? string.Empty : "style='display:none;'"%>>

   2:     <span class="prev"> <a href="<%# (DataItemIndex >= DataRowView.DataView.Count - 1) ? string.Empty : DataRowView.DataView[DataItemIndex + 1]["NodeAliasPath"].ToString() %>" rel="prev"> 

   3:     <%# (DataItemIndex >= DataRowView.DataView.Count - 1) ? string.Empty : "&laquo; " + DataRowView.DataView[DataItemIndex + 1]["BlogPostTitle"].ToString() %> </a> </span>

   4:     

   5:     <span class="next"> <a href="<%# (DataItemIndex <= 0) ? string.Empty : DataRowView.DataView[DataItemIndex - 1]["NodeAliasPath"].ToString() %>" rel="next"> 

   6:     <%# (DataItemIndex <= 0) ? string.Empty : DataRowView.DataView[DataItemIndex - 1]["BlogPostTitle"].ToString() + " &raquo;" %> </a></span>

   7: </p>


And look something like this.
image

No comments:

Post a comment