Archive for February, 2008

h1

Paging in Episerver

February 27, 2008

Paging with Episerver PageList

When you want a list of some sort (Search news, blog, …) and it is getting big you need to implemnt paging. This can be done very easily if you are yousing a Episerver PageList control. The only thing you do is add 2 properties paging and PagesPerPagingItem:

<EPiServer:PageList 
        ID=”SearchResult” runat=”server”
        Paging=”true”  
        PagesPerPagingItem=”15″
        SortOrder=”PublishedDescending”>

That way you will have automatic paging active. BUT! at first you will notice if you are using version 4.61 that the paging isnt working. you get the same page (the first page) whatever page number you click. This is because you need to rebind ans such on postback too. This might be fixed in CMS 5 though.

Paging with asp.net Repeater

Some blogs are made so that all posts or / and comments are made of Episerver XForm posts. To make paging of these I suggest using repeater and PagedDataSource. I found a great article about this that I used the first time. The article is written by Harrison Enholm and explains good how to use it. I added some to this for example number buttons for the pages:

for (int i = 0; i < pages; i++)
{
hl =
new LinkButton();
hl.Command +=
new CommandEventHandler(navClick);
hl.CommandName =
“cmdPage_Click”;
hl.CommandArgument = i.ToString();
hl.Text = (i + 1).ToString();
if ((i == 0) && (!IsPostBack))
{
hl.ToolTip =
“Aktuell sida”
}
else
{
hl.ToolTip =
“Sidan “ + (i + 1).ToString();
}
hl.ID =
“PageNumberButton” + (i + 1).ToString();
hl.EnableViewState =
false;
pageNumbers.Controls.Add(hl);
l =
new Literal();
l.Text =
” “;
l.ID =
“SpaceLiteral” + (i + 1).ToString();
pageNumbers.Controls.Add(l);
}

 That is I have a placeholder beween the prev and next buttons and then in the above loop I add a number linkbutton for each page with a command where I can move the visitor to the page. This and a First Last buttons makes it pretty much equal in functionality as the PageList paging. For more code pls contact me =)

Enjoy! 

Advertisements
h1

The blogging begins!

February 27, 2008

This is my first blog entry so I will introduce myself a little and such to start.

I am a webdeveloper with a big gaming interest and around 30 years of age (+/- 5 years). In my webdevelopment profession I normally work with asp.net (C#), Episerver content management system but also alot others like old ASP (VB), PHP, Java, Lotus Notes and more. 

As a gamer I have a long history of playing games. First I played alot as a young boy on Amiga (500-1200) (Games like Sim City, Dogs of War, Giana Sisters, Bouble Bouble, Prince of Persia, Civilization, Sensible Soccer, Supercars and more). After that I moved on to a PC pretty late but I liked it alot. I started playing mainly 2 games Unreal Tournament (with some serious clan play) And Asherons Call starting in the Beta. I played those 2 games alot (UT I played about 3 years in serious way). After that I tried a few different games , A little Everquest and others until I started playing a game called Dark Age of Camelot. First starting the US Beta and then after that Jumping to the EU beta (The hours US players where playing sucked).

Dark Age of Camelot was my main game for a long time playing Hibernia on Excalibur mainly. I started a guild in beta called Terra Dominus that still lives as a multigaming guild. (My in game name was Moric annunaki and later Moric Forgeworker aka Iaivenda). But later this game also got a bit boring and I was playing alot of different games back and forth and at the same time i met my wife and had children n such.

Last 1,5 years my gaming history has been Cabal Online in the guild Section9 on Mars. As 1 of the top crafters (Swippie aka (GA) Swippie) i have been having a great time playing and will continue so.

Well thats all for my first post. Hopefully more will come soon! =)