FaceBook Like Button Control For ASP.Net

How to use FaceBook Like Button Control?

    • Download the source code for the control attached with this post.
    • Compile the project and add reference to the project or put compiled assembly in BIN folder of your ASP.Net site.
    • On the page where you want to add Likebutton, add reference to this control at top of your page or control file as show below.
      <%@ Register TagPrefix="ByteBlocks" Namespace="ByteBlocks.FaceBookWeb" 
        Assembly="ByteBlocks.FaceBookWeb" %>
    • Now add control tags on your page as shown below.
      <ByteBlocks:FBLikeButton Id="fbLikeButton" runat="server" />
    • Now you need to assign the properties for this control to render the button. The most important and required property is Url. This is URL of the page that you want to associate with Like button. Other properties you can ignore because control will pick default values. But without setting Url, there is no Likebutton.
      //fbLikeButton.Url = Post.AbsoluteLink.AbsoluteUri;
      fbLikeButton.Url = "You Facebook Page URL";
      fbLikeButton.ShowFaces = false;

You can set these properties in code behind or on the control tag itself.

You can add more options in the control if you like. At the end it is doing nothing more than rendering iframe tag. You can see this control in action on this blog on every single post where you are seeing Like button displayed.

Download location: Here

Reff: http://www.byteblocks.com/post/2011/01/11/FaceBook-Like-Button-Control-For-ASPNet.aspx


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s