Adding a ItemTemplate into a repeater the new way

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:

1: rptPager.ItemTemplate = new CompiledTemplateBuilder( new BuildTemplateMethod(

<p>
  BuildItemTemplate ) );
</p>

<p>
  <!--CRLF-->
</p>

<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum2" style="color: #606060;"> 2:</span></pre>

<p>
  <!--CRLF-->
</p>

<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum3" style="color: #606060;"> 3:</span></pre>

<p>
  <!--CRLF-->
</p>

<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum4" style="color: #606060;"> 4:</span> <span style="color: #0000ff;">void</span> BuildItemTemplate(

Control container ) {

<p>
  <!--CRLF-->
</p>

<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum5" style="color: #606060;"> 5:</span> LinkButton

lbPage = new LinkButton() { ID = "lbPage" };

<p>
  <!--CRLF-->
</p>

<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum6" style="color: #606060;"> 6:</span> container.Controls.Add(

lbPage );

<p>
  <!--CRLF-->
</p>

<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum7" style="color: #606060;"> 7:</span> }</pre>

<p>
  <!--CRLF-->
</p>
Loading comments…