kentico - CMS Repeater Select top N row++ -
i need load more button control repeater shown content.
here steps in end after load more button clicked:
- repeater bind data (full data/all rows).
- keep maximum items count (static) repeater.
- set total row show (static) + 1 , initialize value select top n row limit.
- repeater bind data again (the amount show only).
- check if repeater items count less maximum items count, if not hide load more button.
suppose these steps can give me expected output?
//declaration public static int max = 0; public static int totalshow = 0; //setupcontrol() if(!ispostback){ rptitems.classname = "blog"; rptitems.path = "/shared/%" rptitems.databind(); max = rptitems.items.count(); } //this part put under new function totalshow += 1; rptitems.selecttopn = totalshow; rptitems.databind(); lbnloadmore.visible = rptitems.items.count() < max;
besides, i'm confusing functions shown below:
both class cmsrepeater
, what's different? 1 should use in order set limits?
using static
members not approach. values shared users of application. there better ways of storing user-specific data:
- session (server-side)
- js (client-side) , passing them server via query string or hidden field
regarding topn
, selecttopn
, same thing. it's because of backward compatibility.
from algorithmical point of view, there's no need bind data multiple times nor make more 1 round-trip database. need initialize datasource/repeater correct values.
i'd recommend reading following articles inspiration:
Comments
Post a Comment