Adding a ItemTemplate into a repeater the new way

Adding a ItemTemplate into a repeater the new way header image

A colleague recently found a very easy way to add a ItemTemplate into your repeater without having to create the ‘classic’ myTemplate : ITemplate class. So a nice example of how less can be more:

rptPager.ItemTemplate = new CompiledTemplateBuilder(new BuildTemplateMethod(BuildItemTemplate))
void BuildItemTemplate(Control container ) {
  LinkButton lbPage = new LinkButton() { ID = "lbPage" };
  container.Controls.Add(lbPage );
}
Loading comments…