Hi I have a CMSRepeater that I am trying to bind to a custom dataset from the page load event in the code behind file. Here is the repeater in question.
<cms:CMSRepeater ID="rptCandidates" DelayedLoading="true" runat="server" OnItemCommand="_postsRepeater_ItemCommand"
DataBindByDefault="false" EnablePaging="true" PageSize="10"
PagerControl-BackNextLinkSeparator="|" PagerControl-BackText="Previous" PagerControl-NextText="Next"
PagerControl-PageNumbersSeparator="|" PagerControl-PageSize="10" PagerControl-ResultsFormat="{0}-{1} Candidates of {2}"
PagerControl-PagerNumberAreaClass="rightPagination" PagerControl-ResultsClass="leftPagination"
PagerControl-ShowFirstLast="False" PagerControl-ControlCssClass="pagination"
PagerControl-SelectedClass="selected"
PagerControl-HideOnSinglePage="True" ZeroRowsText="No candidates found." PagerControl-SliderSize="5" PagerControl-PagingMode="PostBack" PagerControl-EnableViewState="False">
<ItemTemplate>
<div id="candidate" class="candidate">
<div id="candidate-inner">
<div id="name">
<%# WoodinCampaignHelper.GetProfileUsername(Eval("ID").ToString()) %></div>
<div id="img">
<a class="que" title='<%# CampaignHelper.GetCandidateDescription(Eval("ID").ToString(),int.Parse(Eval("CompetitionID").ToString())) %>'
rel="#">
<img src='<%#CampaignHelper.GetProfilePicture(Eval("ID").ToString()) %>'
width="108px" /></a></div>
<div id="vote">
<div class="votes">
<%#CampaignHelper.GetCandidateVoteCount(Eval("ID").ToString(),int.Parse(Eval("CompetitionID").ToString())) %>
Vote(s)</div>
<div class="vote">
<asp:LinkButton ID="lnkVoteMe" ClientIDMode="Static" CommandArgument='<%#Eval("candidateID").ToString() %>'
runat="server" CssClass="vote_button" CommandName="VoteMe">
<div class="span">Vote</div>
</asp:LinkButton>
</div>
</div>
</div>
</div>
</ItemTemplate>
</cms:CMSRepeater>
And here is the page load event:
protected void Page_Load(object sender, EventArgs e)
{
DataSet dsCandidates = CampaignHelper.GetAllCandidatesAsDataset(CampaignHelper.GetCurrentCompetitionID());
rptCandidates.DataSource = dsCandidates;
rptCandidates.Databind();
//rptCandidates.ReloadData();
}
It works on the first page, but immediately you move to the next page the code seems to break.
As you can see I have tried the reload data as well but it doesn't seem to be working. The reason why am using a cmsrepeater is that it provides a simple way of paging the data. Is there anyway to make this work or do I have to write custom paging for the control and use an ASP repeater.
A good working example will be appreciated. Thanks in advance.