Facebook Bookmark Button for ASP.NET
Facebook Bookmark Button is easy and fast way to save interesting websites and applications inside Facebook environment so they can be quickly found from the list of bookmarks. Implementation of bookmark button increases the possibility that the user which likes some website or application will come again. There is lot of interesting content on the Internet which is hard to find again if it is not bookmarked. People usually forgot to make bookmarks in their Internet browsers, but if there is Facebook bookmark button placed on visible place on the website, it increases the chance that the user will bookmark that website or Facebook application.
Picture of Bookmark button, and the popup shown when it's pressed:
Facebook Bookmark Button ASP.NET control has a demo page inside Demo Website that show how it works. The most important fact is that the Demo website is contained in 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 Bookmark Button demo.
Configuration
Configuration of the Facebook Bookmark Button ASP.NET control is done in ASPX page by setting optional properties and the event handler. If dynamic setting of properties is required, they can be also set in the code behind, for example in Page_Load method. If an event handler is used, new method should be created in the code behind to execute additional code after the bookmark is added.
Optional Properties:
Property Name
Type
Description
OffFacebook
Bool
Set to true if the bookmark button is used on external website. Default value is false.
Event Handlers:
Event Name
Description
AddedBookmark
Name of protected method that is implemented inside the code behind and which will be called after the bookmark is added.
Usage Examples:
Following examples demonstrate usage of Facebook Bookmark Button ASP.NET control inside external website. To use bookmark button inside Facebook iFrame application, parameter OffFacebook can be omitted. Code behind in C# and VB.NET is also shows how to implement event handler that runs when user makes bookmark.
Bookmark Button in ASPX file: <%@ Page MasterPageFile="~/Master.Master" AutoEventWireup="true" Inherits="FVK_Demo.BookmarkButton" %> <%@ Register TagPrefix="fvk" TagName="bookmark" Src="~/FVK/BookmarkButton.ascx" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <title>Facebook Connect Bookmark Button control for ASP.NET</title> <meta name="description" content="ASP.NET Implementation of Facebook Bookmark Button" /> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <fvk:bookmark ID="bookmark1" runat="server" OnAddedBookmark="BookmarkAdded" OffFacebook="true" /> </asp:Content> Code behind in C#:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Facebook;
namespace FVK_Demo
{
public partial class BookmarkButton : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void BookmarkAdded(object sender, EventArgs e)
{
// Add some code to execute on bookmark added
}
}
}
Code behind in VB.NET:
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports Facebook
Namespace FVK_Demo
Public Partial Class BookmarkButton
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
End Sub
Protected Sub BookmarkAdded(sender As Object, e As EventArgs)
' Add some code to execute on bookmark added
End Sub
End Class
End Namespace
|