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:
Facebook Share 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 Share Button demo
ConfigurationConfiguration 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. Properties:
Property Name
Type
Description
Type
String
Type of share button. Available values are 'icon', 'icon_link', 'button', 'button_count', and 'box_count'. Default value is 'icon_link'.
Title
String
Title of Share button. Default value is 'Share'.
Url
String
Url to share. Default value is URL of page where the control is placed.
Usage Examples: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> |