Facebook Comments for ASP.NETFacebook Comment Box control is used to allow users of Facebook Connect web site or Facebook application to place comments about a web site or some specific article on it. There is an option to distinguish comment boxes inside the same web page by setting unique ID for each comment box. Facebook Comment Box became very popular on news websites because it eliminates the requirement to register to discuss some news. Also, there is no need to integrate some other discussion implementation, which usually requires database for storing comments and registered users. Facebook Comments can be integrated in any type of website or Facebook application, not just to allow commenting, but to spread a work about commented content. Each comment creates link back to website from user’s Facebook profile. This way, friends of user are encouraged to see these comments, and also reply to comments, and that leads to increase in traffic on the website. If there is lot of commenting on some website links from users’ profiles, that also increases search engine rating and brings more visitors from them too.
Picture of comment box: Following image shows Facebook Comments ASP.NET control with only one comment on it. There is a live demo with lots of comments on how it works. It can be seen on link provided bellow.
Facebook Comment Box 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 Comment Box demo
ConfigurationConfiguration of Facebook Comments ASP.NET control is done in ASPX page by setting optional properties. Default Comments control which is typically used does not have any property set. However, there is always a chance that some customizations are required, and these are made by setting couple of 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
Xid
String
Unique id. Should be set if there are more comment boxes for the same web site.
PostsNum
String
The max number of posts to display. Default is 10.
Width
Int
Width of the control in pixels. Default is 550.
CssUrl
String
URL of custom CSS style of the control.
Title
String
Title of the feed story published when comment is made. Default is the title of the page from where comment is made.
Url
String
URL of a page where the comment is made i.e. URL of back link.
IsSimple
Bool
A rounded box does not appear around each post on a site if this property is true. Default is false.
IsReverse
Bool
If property is set to true comments are shown in reverse order. Default is false.
Usage Examples:Following examples show registration and insertion of Facebook Comments ASP.NET control in ASPX file. First example shows default Comments control without any property set. Second example shows Facebook Comments control 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 Comments inside ASP.NET page are highlighted. Default Facebook Comments: <%@ Page MasterPageFile="~/Master.Master" AutoEventWireup="true" Inherits="FVK_Demo.Comments" %> <%@ Register TagPrefix="fvk" TagName="comments" Src="~/FVK/Comments.ascx" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <title>Facebook Comments for ASP.NET</title> <meta name="description" content="ASP.NET implementation of Facebook Comments Box C# and VB.NET" /> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <fvk:comments ID="comments1" runat="server" Xid="commentbox1" /> </asp:Content> Facebook Comments ASP.NET control with all properties set: <%@ Page MasterPageFile="~/Master.Master" AutoEventWireup="true" Inherits="FVK_Demo.Comments" %> <%@ Register TagPrefix="fvk" TagName="comments" Src="~/FVK/Comments.ascx" %> <asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"> <title>Facebook Comments for ASP.NET</title> <meta name="description" content="ASP.NET implementation of Facebook Comments Box C# and VB.NET" /> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server"> <fvk:comments ID="comments1" runat="server" Xid="comment_on_something" CssUrl="http://mydomain.com/mycss.css" IsReverse="true" IsSimple="true" PostsNum="5" Title="ASP.NET Facebook Comments" Url="http://vatlab.com" Width="400" /> </asp:Content> |