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

Controlling Sharing Strings

Since Q1 2012 the RadSocialShare offers the ability to change its shared strings (URL and Title) on the client, by using JavaScript. This allows you to set differents strings you want shared according to your custom logic without extra requests to the server.

This is achieved by calling the set_stringsToShare(url, title) Client-side method of the control. Both its arguments are optional and the corresponding strings are not modified if there isn't a new value provided. After this method is called the change is applied not only to the Styled buttons, but also to the Standard (or third party) buttons as well. Their counters are also updated according to the new values after that, which requires a request to the respective network's server.

This can also be done in the OnSocialButtonClicking event for each individual Styled button by calling the set_stringsToShare() method that is exposed by the event arguments object that is passed to the event handler.

These client-side methods do not resolve relative URLs like setting them in the server-side properties does. This means that setting, for example, "~/myPage.aspx" in the UrlToShare property will result in a proper URL being built and sent, but passing the same string to the JavaScript method will not resolve the URL, because this operation can only take place on the server.

See Also

In this article