Setting values dynamically

2 posts, 0 answers
  1. JS
    JS avatar
    4 posts
    Member since:
    Oct 2012

    Posted 21 Jun 2012 Link to this post

    Hi there,

    I'm using SocialShare and I'm setting the Title and the URL to share in the Page_Init event of my page. However, the tweet-button does not get the values from the SocialShare control. When I set them explicitly, the button gets the correct values. I also tried it in the Page_Load event, also without any result.

    Setting the values dynamically for the Facebook Like Button works perfectly.

    I also tried setting the Title and the URL from codebehind by looping through the mainbuttons. This did not work either.

    Does someone have an idea how I can solve this?
  2. Marin Bratanov
    Marin Bratanov avatar
    4441 posts

    Posted 22 Jun 2012 Link to this post


    In case you are using the Standard Twitter button please keep in mind that its original implementation from twitter  has issues with querystrings, so this may be causing the problem in your case. Could you try using the HttpUtility.UrlEncode() method before setting the URL for the twitter button and see if this helps?
    tb.UrlToShare = HttpUtility.UrlEncode(url); //tb is a reference to the TwitterButton

    This will confuse their engine and it will miss the query string.

    Another alternative is to use the styled twitter button instead:
    <telerik:RadSocialButton SocialNetType="ShareOnTwitter" TitleToShare=" " />

    Kind regards,
    Marin Bratanov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Back to Top