Bob Areddy
Top achievements
Rank 1
Bob Areddy
asked on 05 Aug 2013, 02:18 PM
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.
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.
5 Answers, 1 is accepted
0
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
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.
0
Bob Areddy
Top achievements
Rank 1
answered on 09 Aug 2013, 12:19 PM
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.
socialButtonClicked
?
The javascript to open the window is handled by the RadSocialShare control.
0
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
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.
0
Bob Areddy
Top achievements
Rank 1
answered on 09 Aug 2013, 03:03 PM
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.
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.
0
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
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.