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()
{
if (!StopProcessing)
{
headerControl.HeaderClick += SortButtonClicked;
repeater.DataBindByDefault = false;
pagerElem.PageControl = repeater.ID;
// Init data properties.
filter.InitDataProperties(source);
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"
#endregion
}
// Connects repeater with data source. Setup control happens before sort, bind data is done and no sorting.
if (!RequestHelper.IsPostBack())
{
InitHeader();
BindTheData();
}
}
And bind the data function:
private void BindTheData()
{
var customDataSource = source.GetInfoDataSet();
if (infoDataSet.Tables[0].Rows.Count == 0)
{
return;
}
repeater.DataSource = infoDataSet;
repeater.DataBind();
}
Edit:
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.
Edit:
Created event handler for page change events, there I'm fetching the data.