breaking out into server code while rendering javascript
-
Im writing a page that contains a data repeater. within the repeaters item template i go into javascript and declare an SWFObject (this is a javascript helper class for writing out flash videos onto the page). I need to pass the SWFObject some data from the item that is binding to the repeater (see the bold code bit below). If i try this...
//<![CDATA[ var so = new SWFObject("vidHolder.swf", "myVideo", "604", "360", "8"); so.addVariable("thumbURL",'video_clicker.jpg'); so.addVariable("videoURL",'<b><%# Container.DataItem("VideoURL") %></b>');</code> it simply does not work as it wont break into the ASP like it does with the HTML. Does anyone know/understand a way around this? Regards, Guy </x-turndown>
-
Im writing a page that contains a data repeater. within the repeaters item template i go into javascript and declare an SWFObject (this is a javascript helper class for writing out flash videos onto the page). I need to pass the SWFObject some data from the item that is binding to the repeater (see the bold code bit below). If i try this...
//<![CDATA[ var so = new SWFObject("vidHolder.swf", "myVideo", "604", "360", "8"); so.addVariable("thumbURL",'video_clicker.jpg'); so.addVariable("videoURL",'<b><%# Container.DataItem("VideoURL") %></b>');</code> it simply does not work as it wont break into the ASP like it does with the HTML. Does anyone know/understand a way around this? Regards, Guy </x-turndown>
Just make an external method in javascript that takes the url as input and processes it like: function DeclareSWF(url) var so = new SWFObject("vidHolder.swf", "myVideo", "604", "360", "8"); so.addVariable("thumbURL",'video_clicker.jpg'); so.addVariable("videoURL",url); And in the server code just call it : DeclareSWF('<%# Container.DataItem("VideoURL") %>') About : Islam About : Me
-
Im writing a page that contains a data repeater. within the repeaters item template i go into javascript and declare an SWFObject (this is a javascript helper class for writing out flash videos onto the page). I need to pass the SWFObject some data from the item that is binding to the repeater (see the bold code bit below). If i try this...
//<![CDATA[ var so = new SWFObject("vidHolder.swf", "myVideo", "604", "360", "8"); so.addVariable("thumbURL",'video_clicker.jpg'); so.addVariable("videoURL",'<b><%# Container.DataItem("VideoURL") %></b>');</code> it simply does not work as it wont break into the ASP like it does with the HTML. Does anyone know/understand a way around this? Regards, Guy </x-turndown>
Just make an external method in javascript that takes the url as input and processes it like: function DeclareSWF(url) var so = new SWFObject("vidHolder.swf", "myVideo", "604", "360", "8"); so.addVariable("thumbURL",'video_clicker.jpg'); so.addVariable("videoURL",url); And in the server code just call it : DeclareSWF('<%# Container.DataItem("VideoURL") %>')
-
Just make an external method in javascript that takes the url as input and processes it like: function DeclareSWF(url) var so = new SWFObject("vidHolder.swf", "myVideo", "604", "360", "8"); so.addVariable("thumbURL",'video_clicker.jpg'); so.addVariable("videoURL",url); And in the server code just call it : DeclareSWF('<%# Container.DataItem("VideoURL") %>') About : Islam About : Me
but that doesnt solve my problem because you still have to call the javascript and pass a server side variable. Ive already setup the function in the head of the aspx page but in my repeater i have to break into a script block to call 'DeclareSWF'. How do you suggest i do that? Because in the 6 years ive been doing asp.net if never figured it out! :doh: Regards, Guy