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. The control is available in C# and VB.NET programming languages, as part of Facebook ASP.NET (C# and VB.NET) Control library.
![]() 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> 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.
|