Adding Custom Social Link Sharing ASP.Net Control To BlogEngine

I got little tired of adding these social networking site post sharing links to my themes. And I saw that there were few web sites offering these ShareIt or AddIt buttons. Well, I decided to create my own custom control for it. Please see the following link for more details about the control and how to use it instructions. There is little piece of code that you will need to add to PostView to get to use title of your posts as well as URL. Notice that in following code, I have added a server side script that overrides RenderControl method to set LinkTitle and LinkUrl properties of ShareLink control. If you don't add this piece of code, the control will still work but it will pick up URL and title of page from client side. More details as present in the article.

Custom Link Sharing ASP.Net Control

<script runat="server">
public override void RenderControl(HtmlTextWriter writer)
socialShareLink.LinkUrl = Post.AbsoluteLink.AbsoluteUri;
socialShareLink.LinkTitle = Post.Title;

You can download PostView.ascx from the site and see how it is used. All other steps are same as described in article for the control.

Download PostView.ascx (1.60 kb)




-0.2 °C / 31.7 °F

weather conditions Clouds

Monthly Posts

Blog Tags