Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>make a Folder named as : Controls Then add this: InviteControl.aspx simply write : &lt;span id="invitespan" runat="server"&gt;&lt;/span&gt; InviteControl.ascx.cs : public partial class Controls_InviteControl : System.Web.UI.UserControl { /// &lt;summary&gt; /// Show border or not /// &lt;/summary&gt; public bool ShowBorder { set { showBorder = value; } } /// &lt;summary&gt; /// Display email section /// &lt;/summary&gt; public bool EmailInvite { set { emailInvite = value; } } /// &lt;summary&gt; /// Number of rows. Allowed values are from 3 to 10. Default value is 5. /// &lt;/summary&gt; public int Rows { set { rows = value; } } /// &lt;summary&gt; /// Number of columns. Allowed values are from 2,3 and 15. Default value is 5. /// &lt;/summary&gt; public int Colums { set { colums = value; } } /// &lt;summary&gt; /// Set comma separated string of friend ID which you don't want to be in invite list /// &lt;/summary&gt; public string ExcludeFriends { set { excludeFriends = value; } } /// &lt;summary&gt; /// IList of friend IDs which you don't want to be in invite list /// &lt;/summary&gt; public IList&lt;long&gt; ExcludeFriendsList { set { if (value != null) { int i = 0; StringBuilder s = new StringBuilder(); foreach (long id in value) { i++; s.Append(id.ToString()); if (i &lt; value.Count) { s.Append(","); } } excludeFriends = s.ToString(); } } } /// &lt;summary&gt; /// URL where application should be redirected, after an invitation is sent. /// Default is application Canvas URL taken from web.config file. /// &lt;/summary&gt; public string ActionUrl { set { actionUrl = value; } } /// &lt;summary&gt; /// URL where user will be redirected after the invite request is accepted. /// If it's not set, ActionUrl is used. /// &lt;/summary&gt; public string AcceptUrl { set { acceptUrl = value; } } /// &lt;summary&gt; /// Main description which will apear on invite request /// &lt;/summary&gt; public string Content { set { content = value; } } /// &lt;summary&gt; /// Application name displayed on send button and invite request title. /// Default is name taken from web.config file /// &lt;/summary&gt; public string AppName { set { appName = value; } } /// &lt;summary&gt; /// Title of confirmation button inside invite request. Default value is 'Accept' /// &lt;/summary&gt; public string ConfirmButtonTitle { set { confirmButtonTitle = value; } } /// &lt;summary&gt; /// Main title of control /// &lt;/summary&gt; public string MainTitle { set { mainTitle = value; } } /// &lt;summary&gt; /// Refresh display of the control /// &lt;/summary&gt; public void Refresh() { if (mainTitle == null) throw new Exception("Invite Friends Error: Main Title is not set."); if (content == null) throw new Exception("Invite Friends Error: Content is not set."); if (confirmButtonTitle == null) throw new Exception("Invite Friends Error: Confirm Button Title is not set."); if (actionUrl == null) actionUrl = Core.AppConfig.AppCanvasUrl; if (acceptUrl == null) acceptUrl = actionUrl; if (appName == null) appName = Core.AppConfig.AppName; StringBuilder html = new StringBuilder(); html.Append("&lt;fb:serverfbml "); html.Append("width='" + width + "'&gt;"); html.Append("&lt;script type='text/fbml'&gt;"); html.Append("&lt;div style='" + cssStyle + "' class='" + cssClass + "'&gt;"); html.Append("&lt;fb:fbml&gt;"); html.Append("&lt;fb:request-form method=\"POST\" action=\""); html.Append(actionUrl); html.Append("\" content=\""); html.Append(content); html.Append("&lt;fb:req-choice url='"); html.Append(acceptUrl); html.Append("' label='"); html.Append(confirmButtonTitle); html.Append("' /&gt;\" type=\""); html.Append(appName); html.Append("\" invite=\"true\"&gt;"); html.Append("&lt;fb:multi-friend-selector target=\"_top\" condensed=\"false\" exclude_ids=\""); html.Append(excludeFriends); html.Append("\" actiontext=\""); html.Append(mainTitle); html.Append("\" showborder=\""); html.Append(showBorder); html.Append("\" rows=\""); html.Append(rows); if (colums &lt; 5) // fixing bug in FBML (if columns == 5 it renders as it as 4) { html.Append("\" cols=\""); html.Append(colums); } html.Append("\" email_invite=\""); html.Append(emailInvite); html.Append("\" /&gt;"); html.Append("&lt;/fb:request-form&gt; "); html.Append("&lt;/fb:fbml&gt;"); html.Append("&lt;/div&gt;"); html.Append("&lt;/script&gt;"); html.Append("&lt;/fb:serverfbml&gt;"); invitespan.InnerHtml = html.ToString(); } /// &lt;summary&gt; /// Page Load /// &lt;/summary&gt; /// &lt;param name="sender"&gt;&lt;/param&gt; /// &lt;param name="e"&gt;&lt;/param&gt; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Refresh(); } } /// &lt;summary&gt; /// Private members /// &lt;/summary&gt; private string excludeFriends = ""; private string actionUrl = null; private string acceptUrl = null; private string content = null; private string confirmButtonTitle = "Accept"; private string appName = null; private string mainTitle = null; private bool showBorder = true; private bool emailInvite = true; private int rows = 4; private int colums = 4; private string cssStyle = ""; private string cssClass = ""; private int width = 625; /// &lt;summary&gt; /// Obsolete members/methods /// &lt;/summary&gt; [Obsolete("You shouldn't use this property anymore. Use AppName instead")] public string SendButtonTitle { set { appName = value; } } } Then add a page : InviteFriends.aspx copy and paste this : &lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="InviteFriends.aspx.cs" Inherits="InviteFriends" EnableViewState="false" %&gt; &lt;%@ Register Src="~/Controls/InviteControl.ascx" TagName="Invite" TagPrefix="cc" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt; &lt;%= Core.AppConfig.AppName %&gt;&lt;/title&gt; &lt;script type="text/javascript"&gt; window.fbAsyncInit = function() { FB.Canvas.setAutoGrow(); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="page"&gt; &lt;div&gt; &lt;asp:Literal runat="server" ID="lInitFB" /&gt; &lt;form id="form1" runat="server"&gt; &lt;div runat="server" id="dvCanvas"&gt; &lt;div id="workfield"&gt; &lt;div id="invite"&gt; &lt;cc:Invite runat="server" ID="ccInvite" ActionUrl="http://cflluxury.allsocialassets.com/InviteFriends.aspx" Content="Invite to Luxury app" ConfirmButtonTitle="Confirm" MainTitle="Luxury App" /&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id="fb-root"&gt; &lt;/div&gt; &lt;script src="http://connect.facebook.net/en_US/all.js"&gt;&lt;/script&gt; &lt;script&gt; FB.init({ appId: '414171951949853', status: true, // check login status cookie: true, // enable cookies to allow the server to access the session xfbml: true // parse XFBML }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; Then give a link to that invite page from your default page: &lt;a href="InviteFriends.aspx"&gt;Invite Friend&lt;/a&gt; Hope it will help. </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload