Using RadSocialShare in Treeview

6 posts, 0 answers
  1. Bob Areddy
    Bob Areddy avatar
    9 posts
    Member since:
    Jul 2010

    Posted 05 Aug 2013 Link to this post

    I have a treeview which consists of webpages.  I create a RadSocialShare control programmatically so that a Facebook and Twitter link appear next to each page, and I add it to Treeview upon load using

    The node for each is created dynamically and added to the tree using

    node.Controls.Add()

    The problem occurs in the sub nodes, because those are loaded on demand, and it appears that when they are loaded, the javascript behind the social share is not loaded.  So when the link for the social share is click, no action occurs, and no errors are generated.

  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 06 Aug 2013 Link to this post

    Hello,

    Please find attached a sample project showing adding templates at run time containing RadSocialShare controls. Please not that the sub nodes are loaded on demand when user tries to expand a specific parent node. For sample purposes the parent nodes have Facebook sharing button and the sub nodes - Tweeter but both are subscribed for the client-side event  SocialButtonClicked. Clicking on the button will fire the event and executes the event handler declared in the script section of the page.


    Regards,
    Boyan Dimitrov
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Bob Areddy
    Bob Areddy avatar
    9 posts
    Member since:
    Jul 2010

    Posted 09 Aug 2013 Link to this post

    I guess I'm not following, what Javascript am I to place for the function

    socialButtonClicked

    ?

    The javascript to open the window is handled by the RadSocialShare control.
  5. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 09 Aug 2013 Link to this post

    Hello,

    I would like to clarify that "socialButtonClicked" is set for sample purposes to demonstrate that the client-side event is fired properly. Could you please clarify what window you are trying to open that is handled by the RadSocialShare control? 

    Regards,
    Boyan Dimitrov
    Telerik
    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 the blog feed now.
  6. Bob Areddy
    Bob Areddy avatar
    9 posts
    Member since:
    Jul 2010

    Posted 09 Aug 2013 Link to this post

    I'm not sure you understand the issue.

    When you use the RadSocialShare control, you don't need to explicitly set the client side event when one of the share buttons is clicked, it's set automatically by the control.  So if you add a Facebook button, the control creates script to open a window and share the page to Facebook.  If you add a twitter button, the control creates script to open a window and share the page to twitter.

    The problem occurs when the RadSocialShare control is located in a treeview.  If a node is loaded on demand, the script that the RadSocialShare control creates to open the share window doesn't get rendered, so when you click on one of the buttons to share, nothing happens.
  7. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 12 Aug 2013 Link to this post

    Hello,

    I have removed the client-side click events for the tweeter buttons and they behave as expected when clicked - the tweeter window for authorization is opened. Please watch the application behavior here. Could you please reproduce the problem you are facing with the attached project and send it back to us for further investigation.

    Looking forward to your reply.

    Regards,
    Boyan Dimitrov
    Telerik
    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 the blog feed now.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017