Facebook Like Button for ASP.NET

Facebook Like button is the most important component of the Facebook Graph API. Whole concept about Graph API is based on what people like. Likes make connections from people to other stuff like websites, products, movie, etc. When somebody presses like button on some product, a connection is created from this person to this product. Numerous connections from people to people as friends, and from people to stuffs they like, create a Facebook graph.

Click on Facebook Like Button not only creates connection in Facebook graph, but also shares a data about content where that button is located and links to user's friends. Sharing a data also creates a link back to website and that increases rating in search engines, if content on website is frequently shared. Owner of the website also has statistics about shared content, with lots of details.

Facebook Like Button ASP.NET control allows easy integration of Like Button in ASP.NET pages and dynamic configuration from the code behind and data sources. The control is wrapper around XFBML tag, and it also has verification if all parameters are correctly set. In case of typing error, exception is thrown, and the error is immediately seen by developer.

Compiled version and source code version of this ASP.NET control are available in C# and VB.NET programming languages, as part of Facebook iFrame ASP.NET library and Facebook Connect ASP.NET control library.




Picture of Facebook Like Button:

Following picture shows 3 types of like button. From top to bottom, there are: classic Like Button, button count and box count. All other properties for buttons on the picture are default, i.e. they are not set.

like button




Facebook Like Button ASP.NET control has a demo page inside Demo Website that shows how it works. The most important fact is that the Demo website is contained in the package with the library, which is very useful resource for code examples, in both C# and VB.NET, for each control from the library. Look at the Facebook Like Button demo



Configuration

Configuration of the Facebook Like Button ASP.NET control is done in ASPX page by setting optional properties. Default like button, which is typically used, does not have any property set. However, customizations are always possible with properties setting. If dynamic setting of properties is required, they can also be set in the code behind, for example on Page_Load method. Following table shows the list of all properties, with their types and descriptions.


Properties:
facebook login button asp.net
Property Name
Type
Description
facebook login button asp.net
Url
String
URL of the like button. If it's not set, current page URL is used.
facebook login button asp.net
Layout
String
Layout type. Available values are 'standard', 'button_count', and 'box_count'. Default value is 'standard'.
facebook login button asp.net
ShowFaces
Bool
Set to true to show profile pictures of user's friends bellow the like button. Default value is true.
facebook login button asp.net
Width
Int
Width of the like button in pixels. Default value is 450.
facebook login button asp.net
Action
String
Text of the like button. Available values are 'like' and 'recommend'. It will be translated depending on user's language.
facebook login button asp.net
Font
String
Font inside the like button. Available values are 'arial', 'lucida grande', 'segoe ui', 'tahoma', 'trebuchet ms', and 'verdana'.
facebook login button asp.net
ColorScheme
String
Color scheme. Available values are 'light' and 'dark'. Default value is 'light'.
facebook login button asp.net
Reference
String
The reference string for tracking referrals.
facebook login button asp.net
Send
String
If set to true, send button will be shown right to the like button.






Usage Examples:

Following examples show registration and insertion of Facebook Like Button ASP.NET control in ASPX file. The first example shows default Like Button without any property set. The second example shows Like Button with all properties set. Examples of ASPX files show only the code required for registration and integration of ASP.NET control in a web page. To see all requirements for registered components, including JavaScript, CSS style and header setting, please look at the manual for page requirements. For following examples, all page requirements are placed in ASP.NET master page. Important parts for registration and integration of Facebook Like Button inside ASP.NET page are highlighted.


Default Facebook Like Button:
 <%@ Page MasterPageFile="~/Master.Master" AutoEventWireup="true" Inherits="FVK_Demo.LikeButton" %%>
 <%@ Register TagPrefix="fvk" TagName="likebutton" Src="~/FVK/LikeButton.ascx" %%>
 <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"%>
    <title%>Facebook Like Button for ASP.NET</title%>
    <meta name="description" content="ASP.NET implementation of Facebook Like Button in C# and VB.NET" /%>
 </asp:Content%>
 <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"%>
    <fvk:likebutton ID="like1" runat="server" /%>
 </asp:Content%>

Facebook Like Button with all properties set:
 <%@ Page MasterPageFile="~/Master.Master" AutoEventWireup="true" Inherits="FVK_Demo.LikeButton" %%>
 <%@ Register TagPrefix="fvk" TagName="likebutton" Src="~/FVK/LikeButton.ascx" %%>
 <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"%>
    <title%>Facebook Like Button for ASP.NET</title%>
    <meta name="description" content="ASP.NET implementation of Facebook Like Button in C# and VB.NET" /%>
 </asp:Content%>
 <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"%>
    <fvk:likebutton ID="like1" runat="server"
       Url="http://vatlab.com"
       Action="recommend"
       Font="tahoma"
       Layout="box_count"
       SetColorScheme="dark"
       ShowFaces="false"
       Width="550"
    /%>
 </asp:Content%>

 

Customer Testimonials

"The Facebook Visual Kit is a great piece of software. It provides a hassle-free wrapper around a number of Facebook controls, leaving you to get on with the development without having to endlessly trawl through Google for help! The best part about the FVK though, is the outstanding level of support. No quibbles, just great support!"

Mark Brassington, Black Halo Games

Customer Spotlight



Vote for your favorites

Facebook development platform