Hi Alexander,
It's difficult to say why it doesn't work for you, but I created a simple control and it works:
Template code (DemoPage.aspx):
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="~/CMSWebParts/Demo/DemoPage.aspx.cs" Inherits="CMSApp.CMSWebParts.Demo.DemoPage" %>
<!-- Register my custom control with pagination -->
<%@ Register Src="~/CMSWebParts/Demo/DemoPager.ascx" TagPrefix="uc1" TagName="DemoPager" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<!-- Add my custom control on page -->
<uc1:DemoPager runat="server" id="Unipager" />
</div>
</form>
</body>
</html>
Demo control code behind (DemoPager.ascx.cs):
using System;
using System.Web.UI;
using CMS.DocumentEngine;
using CMS.Helpers;
public partial class CMSApp_CMSWebParts_Demo_DemoPager : UserControl
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
var ds = DocumentHelper.GetDocuments("CMS.MenuItem").Path("/", PathTypeEnum.Children).OrderBy("NodeLevel, NodeOrder");
// Checks that the DataSet isn't empty
if (DataHelper.DataSourceIsEmpty(ds)) return;
// Binds the DataSet to the UniView control
UniView1.DataSource = ds;
UniView1.DataBind();
}
}
Demo contol ascx file (DemoPager.ascx):
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DemoPager.ascx.cs" Inherits="CMSApp_CMSWebParts_Demo_DemoPager" %>
<h3>Demo Unipager</h3>
<cms:UniView ID="UniView1" runat="server">
<ItemTemplate>
<li>
<%# HTMLHelper.HTMLEncode(Convert.ToString(Eval("NodeName"))) %>
</li>
</ItemTemplate>
<HeaderTemplate>
<ul>
</HeaderTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</cms:UniView>
<cms:UniPager ID="UniPager1" runat="server" PageControl="UniView1" GroupSize="10" PageSize="3">
<PageNumbersTemplate>
<a class="demo" href="<%# Eval("PageURL") %>"><%# Eval("Page") %></a>
</PageNumbersTemplate>
</cms:UniPager>
And as result I got list of items and pagination: