New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Server-Side API

  • Demo Configurator

Choose the MainButtons






Choose Orientation


Use LabelText

Set UrlToShare



The RadSocialShare is primarily a user interaction control and does not offer any specific server-side functionality. You can, however, programmatically create the Button Collections depending on some logic. In this example checkboxes are used, yet you can store a user's preferences in a file and read the information from it. For example, when a user registers on the site he/she can provide a list of networks that he/she wishes to connect to and the RadSocialShare can be configured to acknowledge these preferences.

Note that controls should be created early in the page lifecycle in order to be persisted across postbacks. This is why they are created in the Page Load event in this demo and not in the button click event, as Page Load is the earliest point in which you can check the state of a checkbox. Ultimately control creation should be done in the Page Init event or re-done by the developer after each postback if done in the button click event.

This RadSocialShare has only one button defined - the CompactButton button. A click will open the popup with the rest. You can choose which of the buttons to have on the page initially via the checkboxes in the configurator.

  • DefaultVB.aspx
  • DefaultVB.aspx.vb
<%@ Page Language="vb" AutoEventWireup="true" CodeFile="DefaultVB.aspx.vb" Inherits="Telerik.Web.Examples.SocialShare.ServerSideAPI.DefaultVB" %>

<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <div class="demo-containers">
    <div class="demo-container">
        <asp:UpdatePanel ID="Updatepanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <div class="shareWrapper">
                    <telerik:RadSocialShare RenderMode="Lightweight" runat="server" ID="RadSocialShare1" UrlToShare="http://www.telerik.com/products/aspnet-ajax.aspx"
                        TitleToShare="ASP.NET AJAX Controls, .NET Web UI Components | Telerik">
                        <MainButtons>
                            <telerik:RadCompactButton></telerik:RadCompactButton>
                        </MainButtons>
                        <CompactButtons>
                        </CompactButtons>
                    </telerik:RadSocialShare>
                </div>

            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </div>
    <qsf:ConfiguratorPanel runat="server">
        <Views>
            <qsf:View>
                <qsf:ConfiguratorColumn runat="server" Size="Medium">
                    <h4>Choose the MainButtons</h4>
                    <asp:CheckBoxList ID="ButtonsCheckBoxList" runat="server" AutoPostBack="false" RepeatColumns="3">
                        <asp:ListItem Text="ShareOnTwitter" Value="ShareOnTwitter">
                        </asp:ListItem>
                        <asp:ListItem Text="LinkedIn" Value="LinkedIn">
                        </asp:ListItem>
                        <asp:ListItem Text="Delicious" Value="Delicious">
                        </asp:ListItem>
                        <asp:ListItem Text="Blogger" Value="Blogger">
                        </asp:ListItem>
                        <asp:ListItem Text="Digg" Value="Digg">
                        </asp:ListItem>
                        <asp:ListItem Text="Reddit" Value="Reddit">
                        </asp:ListItem>
                        <asp:ListItem Text="StumbleUpon" Value="StumbleUpon">
                        </asp:ListItem>
                        <asp:ListItem Text="MySpace" Value="MySpace">
                        </asp:ListItem>
                        <asp:ListItem Text="Tumblr" Value="Tumblr">
                        </asp:ListItem>
                        <asp:ListItem Text="ShareOnFacebook" Value="ShareOnFacebook">
                        </asp:ListItem>
                        <asp:ListItem Text="ShareOnYammer" Value="ShareOnYammer">
                        </asp:ListItem>
                        <asp:ListItem Text="ShareOnPinterest" Value="ShareOnPinterest">
                        </asp:ListItem>
                        <asp:ListItem Text="GoogleBookmarks" Value="GoogleBookmarks">
                        </asp:ListItem>
                        <asp:ListItem Text="ShareOnGooglePlus" Value="ShareOnGooglePlus">
                        </asp:ListItem>
                        <asp:ListItem Text="MailTo" Value="MailTo">
                        </asp:ListItem>
                        <asp:ListItem Text="SendEmail" Value="SendEmail">
                        </asp:ListItem>
                    </asp:CheckBoxList>
                </qsf:ConfiguratorColumn>
                <qsf:ConfiguratorColumn runat="server" Size="Narrow">
                    <h4>Choose Orientation</h4>
                    <asp:RadioButtonList ID="OrientationRadioButtonList" runat="server" AutoPostBack="false">
                        <asp:ListItem Text="Horizontal" Selected="True" Value="Horizontal"></asp:ListItem>
                        <asp:ListItem Text="Vertical" Value="Vertical"></asp:ListItem>
                    </asp:RadioButtonList>
                </qsf:ConfiguratorColumn>
                <qsf:ConfiguratorColumn runat="server" Size="Narrow">
                    <h4>Use LabelText</h4>
                    <asp:CheckBox ID="ShowLabelsCheckbox" Text="Show text next to the buttons" runat="server" Width="205"></asp:CheckBox>
                    <div class="instructionTitle">
                        Set UrlToShare
                    </div>
                    <br />
                    <qsf:TextBox ID="UrlTextbox" runat="server" Width="300px" Text="http://www.telerik.com/products/aspnet-ajax.aspx"></qsf:TextBox>
                    <br />
                    <br />
                    <qsf:Button ID="ConfigureButton_Click" Text="Configure SocialShare" OnClick="Configure_Click"
                        runat="server">
                    </qsf:Button>
                </qsf:ConfiguratorColumn>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance