Solved

Refreshing Javascript SRC Without Full PostBack

Posted on 2012-03-26
4
476 Views
Last Modified: 2012-04-02
Dear All,

Please can someone kindly assist me with the following.

We have an ASP.NET Label (or Literal) Control where the Text property which is rendered to the page is a Javascript script tag with a SRC pointing to a remote URL (that inserts a video player).

We are trying to change the Text property of this control to a different javascript SRC value to render a different video but without having to POSTBACK the whole page.

Whilst the Text property of the label IS getting changed, the script tag is not getting re-rendered, i.e. the new video file is not getting called.

We have tried partial AJAX postback and dynamic creation of new control but to no avail.  The only way that we can get the new <script src> to re-render is to effect a full POSTBACK which is not ideal for other reasons.

I am guessing this should be possible.  Something in PAGE_LOAD must be doing this?

Thank you for your time.
0
Comment
Question by:antdow
  • 2
4 Comments
 
LVL 38

Expert Comment

by:Tom Beck
Comment Utility
This question requires some additional clarification.

An asp:Label whose Text property is a javascript script tag with a src pointing to a remote url?

I'm trying to get a mental picture of this.

Javascript script tag with a remote url for the src:
 <script type="text/javascript" src="http://remoteUrl.com"></script>

<asp:Label ID="whatever" Text="<script type='text/javascript' src='http://remoteUrl.com' />" runat="server" />

Why? It doesn't make sense.
0
 
LVL 1

Author Comment

by:antdow
Comment Utility
Hi, and thank you for your response.

The URL looks something like this...

<script src="http://content.bitsontherun.com/players/nPripu9l-zNzx3xpv.js" type="text/javascript"></script>

The reason we are using this is that embedding this automatically provides us with a video player (JW Player) and loads a video (identified by the dynamically-generated ID).  This video is served by Bits On The Run, a Content Delivery Network.

Have tried a Label and Literal control.  Works perfectly EXCEPT when we try to refresh the dynamic value within the URL WITHOUT doing a full postback.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 500 total points
Comment Utility
0
 
LVL 1

Author Closing Comment

by:antdow
Comment Utility
Thanks CodeCruiser, this was incredibly helpful in getting this to work.  Apologies for the delay accepting your solution.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now