I forgot to mention one crucial issue, I can't debug, I don't have repo locally, only way of debugging is by logging stuff with EventLogger..
And yes, repeater is showing the first page data, and number of items is set correctly.
Is there a way to get SQL generated when navigating other pages? I could log that and check whats in there.
Here is my SetupControl method:
protected void SetupControl()
headerControl.HeaderClick += SortButtonClicked;
repeater.DataBindByDefault = false;
pagerElem.PageControl = repeater.ID;
// Init data properties.
filter.OnFilterChanged += filter_OnFilterChanged;
source.OnFilterChanged += filter_OnFilterChanged;
// Basic control properties
repeater.HideControlForZeroRows = HideControlForZeroRows;
repeater.ZeroRowsText = ZeroRowsText;
// Data source properties
source.FilterName = filter.ID;
source.CacheItemName = CacheItemName;
source.CacheDependencies = CacheDependencies;
source.CacheMinutes = 0;
// UniPager properties
pagerElem.PageSize = PageSize;
pagerElem.GroupSize = GroupSize;
pagerElem.QueryStringKey = QueryStringKey;
pagerElem.DisplayFirstLastAutomatically = DisplayFirstLastAutomatically;
pagerElem.DisplayPreviousNextAutomatically = DisplayPreviousNextAutomatically;
pagerElem.HidePagerForSinglePage = HidePagerForSinglePage;
pagerElem.Enabled = EnablePaging;
pagerElem.PagerMode = UniPagerMode.PostBack;
#region "UniPager template properties"
// Connects repeater with data source. Setup control happens before sort, bind data is done and no sorting.
And bind the data function:
private void BindTheData()
var customDataSource = source.GetInfoDataSet();
if (infoDataSet.Tables.Rows.Count == 0)
repeater.DataSource = infoDataSet;
P.S: You were right, pager was set too early in the life cycle, repeater was bound to the data source after the pager was configured.I just moved data bind at the beggining of the page load. And apparently repeater needs to be rebound on each postback which makes perferct sense, database needs to be contacted each time, as each request for a new page generates a postback. It really makes it that much difficult when you can't debug.
Now I wonder, how could I condition that DataBind to be called on postback, but not on each postback, only when unipager needs to fetch data for another page.
Created event handler for page change events, there I'm fetching the data.