Sticky Post

Topics: Controls
Feb 16, 2011 at 10:47 AM
Edited Feb 17, 2011 at 12:01 AM

Hey guys, I made some modification on PostList.aspx and PostList.aspx.cs to support Stick Post.


Since my site is offline for a while after migrating from .NET 2.0 to .NET 4.0 I guess I'll just put the instructions here


Download the Sticky User Control here:^_Control.rar

and extract it in User Controls folder


Open PostList.aspx.cs and add this code:

if (post.Tags.Contains("sticky")) continue;


foreach (Post post in visiblePosts.GetRange(index, stop))
	if (counter == stop)

	' insert the code here

	PostViewBase postView = (PostViewBase)LoadControl(path);
	postView.ShowExcerpt = showExcerpt;
	postView.DescriptionCharacters = descriptionCharacters;
	postView.Post = post;
	postView.Index = counter;
	postView.ID = post.Id.ToString().Replace("-", string.Empty);
	postView.Location = ServingLocation.PostList;
	postView.ContentBy = this.ContentBy;


How to use Sticky Control

for example I want to put my control in PostList.aspx, I just need to register the control and add it inline

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="PostList.ascx.cs" EnableViewState="false" Inherits="User_controls_PostList" %>
<!-- sticky control -->
    <%@ Register Src="Sticky.ascx" TagName="Sticky" TagPrefix="uc1" %>
    <uc1:Sticky runat="server" ID="uc_sticky" />
<!-- end: sticky control -->

<div runat="server" id="posts" class="posts" />

<div id="postPaging">
  <a runat="server" ID="hlPrev" style="float:left">&lt;&lt; <%=Resources.labels.previousPosts %></a>
  <a runat="server" ID="hlNext" style="float:right"><%=Resources.labels.nextPosts %> &gt;&gt;</a>


How to make a Sticky

  1. Add a New Entry
  2. Beautify your content using HTML in content editor
  3. Description and Categories are optional
  4. Most important part?? TAGS
  5. Add a tag named "sticky" (no double quotes)
  6. Publish it!
  7. and that's it! your sticky post will apear at the top, and it will never apear on Post List :)
  8. you can actually put a style on your Sticky panel. Refer to the How to use Sticky Control code above.


Code supports BE.NET 1.6.x to 2.0 

Feb 16, 2011 at 1:13 PM

ok an update

I made a Sticky User Control instead of modifying PostList.aspx and PostList.aspx.cs files

check the update here:

Feb 16, 2011 at 3:29 PM

I'm getting a Server Error when I click that link. :(

Feb 16, 2011 at 3:30 PM

Nice, thanks

Feb 16, 2011 at 4:23 PM

Same here in the server error.

Feb 16, 2011 at 4:25 PM

It worked earlier today but now the error exists.

Feb 16, 2011 at 11:15 PM

sorry. Am updating my BE.NET to 2.0 :D

Feb 17, 2011 at 12:01 AM

I updated the first post... my site is still offline >:

Feb 23, 2011 at 2:04 AM

ok. jaysonragasa is now online.