SocialShare

Controls

All Controls

SocialShare

Rate this demo

Thank you for your post!
Submit a support ticket
If you have an active license or trial, you have access to dedicated support from Telerik’s developers. Response time is 24h for active licenses and 72h for trials, Mon-Fri.
Post in the forums
If you don’t have access to support or would like to help other people by sharing your problem, reach out to our active community in the forums.

SocialShare - Client-side events

Clear log Event log:

Standard third party buttons


The RadSocialShare control exposes the following client-side events:

Styled buttons client events:

  • OnSocialButtonClicking - fired just when a user clicks on a RadSocialButton and the share popup has not been shown yet. This event can be cancelled. Its arguments expose the type of the share button social network and the share url
  • OnSocialButtonClicked - fired when a user has already clicked on a RadSocialButton. Its arguments expose the type of the share button social network, the share url and the popup share dialog.

Standard third party buttons client events:

  • OnFacebookLike - fired when a user clicks Facebook Like button.
  • OnFacebookUnLike - fired when a user clicks Facebook UnLike button.
  • OnFacebookSend - fired when a user sends an url through Facebook Send button.
  • OnTweet - fired when a user clicks Twitter Tweet button
  • OnGooglePlusOneOn - fired when a user votes through Google +1 button
  • OnGooglePlusOneOff - fired when a user unvotes through Google +1 button
  • OnLinkedInShare - fired when a user clicks standard third party LinkedIn button
C# VB
Show code in new window Demo isolation steps
<%@ Page Language="C#"  %>

<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>ASP.NET SocialShare Demo - Client-side events</title>
    <style type="text/css">
        .sshForm
        {
            margin-top: 15px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="true" />
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />
    <script type="text/javascript">

        function OnFacebookLike(sender, args) {
            logEvent("OnFacebookLike event fired!The url you liked is: " + args.get_url());
        }

        function OnFacebookUnLike(sender, args) {
            logEvent("OnFacebookUnLike event fired! The url you unliked is: " + args.get_url());
        }

        function OnFacebookSend(sender, args) {
            logEvent("OnFacebookSend event fired! The url you sent is: " + args.get_url());
        }

        function OnTweet(sender, args) {
            logEvent("OnTweet event fired! The url you tweeted is: " + args.get_url());
        }

        function OnGooglePlusOneOff(sender, args) {
            logEvent("OnGooglePlusOneOff event fired! The url you unvoted for is: " + args.get_url());
        }

        function OnGooglePlusOneOn(sender, args) {
            logEvent("OnGooglePlusOneOn event fired! The url you voted for is: " + args.get_url());
        }
        function OnLinkedInShare(sender, args) {
            logEvent("OnLinkedInShare event fired! The url you shared is: " + args.get_url());
        }
        function OnSocialButtonClicking(sender, args) {
            var type = args.get_socialNetType();
            logEvent("OnSocialButtonClicking event is fired! The clicked button is " + type + ". This event can be cancelled!");
            var text = type == "CompactButton" ? "Are you sure you want to open the compact popup ?" : "Are you sure you want to share the url " + args.get_url() + " ?";
            args.set_cancel(!confirm(text));
        }

        function OnSocialButtonClicked(sender, args) {
            var text = args.get_socialNetType() == "CompactButton" ? ". The compact popup is shown!" : ". The url you shared is: " + args.get_url();
            logEvent("OnSocialButtonClicked event fired!The clicked button is: " + args.get_socialNetType() + text);
        }

    </script>
    <telerik:RadSocialShare ID="RadSocialShare1" runat="server" OnFacebookLike="OnFacebookLike"
        OnFacebookUnLike="OnFacebookUnLike" OnTweet="OnTweet" OnGooglePlusOneOff="OnGooglePlusOneOff"
        OnGooglePlusOneOn="OnGooglePlusOneOn" OnSocialButtonClicking="OnSocialButtonClicking"
        OnFacebookSend="OnFacebookSend" OnSocialButtonClicked="OnSocialButtonClicked"
        OnLinkedInShare="OnLinkedInShare" UrlToShare="http://www.telerik.com" TitleToShare=".NET UI Controls, Reporting, Visual Studio Tools, Agile Project Management, Automated Testing, ASP.NET Web CMS by Telerik">
        <MainButtons>
            <telerik:RadSocialButton SocialNetType="ShareOnFacebook"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="ShareOnTwitter"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="ShareOnYammer"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="ShareOnPinterest" UrlToShare="http://demos.telerik.com/aspnet-ajax/Common/Images/SiteNav/telerik-logo.png"
                TitleToShare=".NET UI Controls, Reporting, Visual Studio Tools, Agile Project Management, Automated Testing, ASP.NET Web CMS by Telerik">
            </telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="Blogger"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="Delicious"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="Digg"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="GoogleBookmarks"></telerik:RadSocialButton>
               <telerik:RadSocialButton SocialNetType="ShareOnGooglePlus"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="LinkedIn"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="MySpace"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="Reddit"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="StumbleUpon"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="Tumblr"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="MailTo"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="SendEmail"></telerik:RadSocialButton>
            <telerik:RadLinkedInButton CounterMode="Horizontal" ShowZeroCount="true"></telerik:RadLinkedInButton>
            <telerik:RadFacebookButton ButtonType="FacebookLike" ButtonLayout="ButtonCount">
            </telerik:RadFacebookButton>
            <telerik:RadFacebookButton ButtonType="FacebookSend"></telerik:RadFacebookButton>
            <telerik:RadTwitterButton CounterMode="Horizontal"></telerik:RadTwitterButton>
            <telerik:RadGoogleButton AnnotationType="Bubble"></telerik:RadGoogleButton>
            <telerik:RadCompactButton></telerik:RadCompactButton>
        </MainButtons>
        <CompactButtons>
            <telerik:RadSocialButton SocialNetType="ShareOnFacebook"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="ShareOnTwitter"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="ShareOnYammer"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="ShareOnPinterest" UrlToShare="http://demos.telerik.com/aspnet-ajax/Common/Images/SiteNav/telerik-logo.png"
                TitleToShare=".NET UI Controls, Reporting, Visual Studio Tools, Agile Project Management, Automated Testing, ASP.NET Web CMS by Telerik">
            </telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="Blogger"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="Delicious"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="Digg"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="GoogleBookmarks"></telerik:RadSocialButton>
               <telerik:RadSocialButton SocialNetType="ShareOnGooglePlus"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="LinkedIn"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="MySpace"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="Reddit"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="StumbleUpon"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="Tumblr"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="MailTo"></telerik:RadSocialButton>
            <telerik:RadSocialButton SocialNetType="SendEmail"></telerik:RadSocialButton>
        </CompactButtons>
    </telerik:RadSocialShare>
    <qsf:EventLogConsole ID="EventLogConsole1" runat="server" AllowClear="true"></qsf:EventLogConsole>
    </form>
</body>
</html>