?
Solved

AddThis.com Social Buttons After Update Panel Postback

Posted on 2014-09-05
2
Medium Priority
?
368 Views
Last Modified: 2014-09-22
Hi,

I am having issues keeping the AddThis Buttons live after a postback.

        Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder()
        sb.Append("<script type=""text/javascript"" src=""//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4d7531fa1e1f4be5""></script>")

        If (Not ClientScript.IsStartupScriptRegistered("SocialJava")) Then
            ScriptManager.RegisterStartupScript(Me, Me.GetType(), "SocialJava", sb.ToString(), False)
        End If

Open in new window


I can fire it after the load and it will work once or on load and it will work once, but never a second time.

I have tried lots of solutions to get it working, but i'm running into issues as its an external file?

Any help would be appreciated?

Cheers
Karl
0
Comment
Question by:Karl Blackburn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 40307130
check this page : http://www.addthis.com/blog/2013/05/07/a-brief-history-of-using-addthis-dynamically/#.VAp0imR5Odw

so put the following in head section : <script src="http://s7.addthis.com/js/300/addthis_widget.js#async=1" type="text/javascript">

and use :
        Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder()
        sb.Append("<script type=""text/javascript"">window.onload = function() { addthis.init(); }</script>")

        If (Not ClientScript.IsStartupScriptRegistered("SocialJava")) Then
            ScriptManager.RegisterStartupScript(Me, Me.GetType(), "SocialJava", sb.ToString(), False)
        End If

Open in new window

0
 

Author Comment

by:Karl Blackburn
ID: 40308637
Hi,

I looked through this article previously, but your example really helps.

Unfortunately it still won't fire on either load or postback unless I use my url -

"//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4d75gfhdgfhdgfh"

but then this again won't fire on postback.

Anything spring to mind?

Cheers
Karl
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question