My first meaningful EPiServer control... z Biedronki* :)
The challenge - The site that we will be coding will have its pages tagged with episerver categories. Implement a control that will list all the pages tagged with a specific category. The control aspx code seems looks pretty straightforward and is derivative of some other controls that are defined in the EPiServer sample site:
1<%@ Control Language="C#" AutoEventWireup="false" CodeFile="CategoryListing.ascx.cs" Inherits="development.templates.Units.CategoryListing" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
2<%@ Register TagPrefix="EPiServer" Namespace="EPiServer.WebControls" Assembly="EPiServer" %>
3<div id="rightmenudivStartPage">
4 <div class="listheadingcontainer">
5 <div class="listheadingleftcorner"></div>
6 <a class="listheading leftfloating" href="<%=EventRootPage.LinkURL%>">
7 <%= EventRootPage.PageName %>
8 </a>
9 <div class="listheadingrightcorner"></div>
10 </div>
11 <EPiServer:PageList runat="server" ID="PageList1">
12 <ItemTemplate>
13 <div class="startpagecalendaritem">
14 <span class="datelistingtext">
15 <episerver:property ID="Property1" runat="server" PropertyName="PageLink" CssClass="StartCalendar" />
16 <span class="Normal">
17 <episerver:property ID="Property3" runat="server" PropertyName="MainIntro" />
18 </span>
19 </div>
20 </ItemTemplate>
21 </EPiServer:PageList>
22 <br/>
23 <br/>
24</div>
The wirst thing you will notice after looking at the code is that PageList is pretty much a standard ASP.NET reinvented and rehashed. GREAT! Sounds like we can use the Data binding, right? That’s also true: