?
Solved

Refreshing Javascript SRC Without Full PostBack

Posted on 2012-03-26
4
Medium Priority
?
484 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
[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
4 Comments
 
LVL 38

Expert Comment

by:Tom Beck
ID: 37765290
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
ID: 37765511
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 2000 total points
ID: 37765543
0
 
LVL 1

Author Closing Comment

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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

762 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