Facebook Share Button for ASP.NET
Facebook Share Button is used for sharing interesting content with Facebook friends. It can be anything from news, articles, link to products, YouTube videos, Facebook applications, etc. Sharing content creates link back to website or Facebook application where the content is located. It brings more visitors from links directly, and from increased rating on search engines. Share Button is replaced with Facebook Like Button when Graph API is released. Facebook recommends using Like Button, but Share Button is still used very frequently used on many websites, small ones and professional. It is also very common to find Like Button and Share Button on the same page.
Picture of the 5 types of buttons:
Configuration of the Facebook Share Button ASP.NET control is done in ASPX page by setting optional properties. If dynamic setting of properties is required, they can be also set in the code behind, for example on Page_Load method. Following table shows the list of all properties with their types and descriptions.
Following examples show registration and insertion of Facebook Share Button ASP.NET control in ASPX file. There is an example of creating 5 types of share buttons from picture above. For each type, different properties are set. The first control creates share button of type 'icon', with URL set to page where it is placed. The second one creates default button. The third creates 'button' type, with defined Title property. The 4th creates share button of type 'button_count' with defined URL. The last one creates share button of type 'box_count'.
Default Facebook Like Button:
<%@ Page MasterPageFile="~/Master.Master" AutoEventWireup="true" Inherits="FVK_Demo.ShareButton" %> <%@ Register TagPrefix="fvk" TagName="sharebutton" Src="~/FVK/ShareButton.ascx" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <title>Facebook Share Button for ASP.NET</title> <meta name="description" content="ASP.NET Share button control for Facebook Connect web sites." /> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <fvk:sharebutton id="sharebutton1" Type="icon" runat="server" /> <fvk:sharebutton id="sharebutton2" Type="icon_link" runat="server" /> <fvk:sharebutton id="sharebutton3" Type="button" runat="server" Title="share" /> <fvk:sharebutton id="sharebutton4" Type="button_count" runat="server" Url="http://vatlab.com" /> <fvk:sharebutton id="sharebutton5" Type="box_count" runat="server" /> </asp:Content>