London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

EPiServer:PageList Paging - Alloy Tech Blog Example

Vote:
 
Hello everyone,

I am having some problems add a pager to the EPiServer pagelist on the Alloy Tech blog example. The pager appears and initilizes correctly but when it posts back it doesn't update the page index:
http://kga.fr.emperor-design.com/en/Company/CEO-Blog/

Here is the orginal control:

<EPiServer:PageList runat="server" DataSource="<%# BlogItems %>" MaxCount="<%# MaxCount %>">
	<ItemTemplate>
		<hr />
                <Blog:ItemSummary runat="server" SelectedPage="<%# Container.CurrentPage %>" SummaryTextLength="<%# SummaryTextLength %>" ShowImage="false" ShowWriter="false" />
        </ItemTemplate>
</EPiServer:PageList>
    

I have simple added the following:

<EPiServer:PageList runat="server" DataSource="<%# BlogItems %>" MaxCount="<%# MaxCount %>" Paging="true" PagesPerPagingItem="1">
	<ItemTemplate>
		<hr />
                <Blog:ItemSummary runat="server" SelectedPage="<%# Container.CurrentPage %>" SummaryTextLength="<%# SummaryTextLength %>" ShowImage="false" ShowWriter="false" />
        </ItemTemplate>
</EPiServer:PageList>
    

In addition the PageDataCollection BlogItems is protected; I changed this to public static.

I am not sure what else it can be?

Thanks,
Andy
 
#55428
Dec 01, 2011 16:54
Vote:
 

I think the problem is with DataBinding. Try and set the DataSource from code-behind instead:

<EPiServer:PageList runat="server" ID="BlogPostList" MaxCount="<%# MaxCount %>" Paging="true" PagesPerPagingItem="1">
	<ItemTemplate>
	  <hr />
		<Blog:ItemSummary runat="server" SelectedPage="<%# Container.CurrentPage %>" SummaryTextLength="<%# SummaryTextLength %>" ShowImage="false" ShowWriter="false" />
	</ItemTemplate>
</EPiServer:PageList>
protected override void OnLoad(EventArgs e)
{
	base.OnLoad(e);

	BlogPostList.DataSource = BlogItems;

	...
}

        

#55443
Edited, Dec 01, 2011 20:56
Vote:
 

Hello Frederik,

 

Thats great; seems to work.

 

Thanks again for your help.

Andy

#55517
Dec 06, 2011 12:33
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.