locked
Change a video url in code behind RRS feed

  • Question

  • User-334723271 posted

    If have this tag on the html5 side

    <a class="player" id="encourage" runat="server" data-property="{videoURL:'https://www.youtube.com/watch?v=jbxg',containment:'#home', showControls:false, autoPlay:true, loop:true, mute:false, startAt:0, opacity:1, quality:'default'}"></a>

    The user needs to be able to change which video will appear on the website - I need to be able change the videoURL in the code behind which will be queried from a database in my asp.net C# application.

    Any suggestions? 

    Thanks

    Louie

    Wednesday, January 29, 2020 8:47 PM

Answers

  • User475983607 posted

    Try removing the runat=server attribute.  Other than that I get markup that matches your original code.  Not sure what else I can do...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 29, 2020 9:21 PM

All replies

  • User475983607 posted

    Use code blocks,<% %>, and  a property.

    <a class="player" 
                id="encourage" 
                data-property="{videoURL:'<%=VideoUrl %>',containment:'#home', showControls:false, autoPlay:true, loop:true, mute:false, startAt:0, opacity:1, quality:'default'}"></a>
    
        public partial class WebForm1 : System.Web.UI.Page
        {
            public string VideoUrl { get; set; }
            protected void Page_Load(object sender, EventArgs e)
            {
                VideoUrl = "https://www.youtube.com/watch?v=jbxg";
            }
        }

    Wednesday, January 29, 2020 8:57 PM
  • User-334723271 posted

    Thanks, I tried that and still doesn't work on pageload. The video plays fine when url is in the tag - anything I do to change it in the code behind it doesn't work.

    Wednesday, January 29, 2020 9:10 PM
  • User-334723271 posted

    Also on the html side it a blue squiggly line underneath  '<%=VideoUrl %>' on mouse over it reads "This is not a scriptlet. Will be output as plaintext."

    Wednesday, January 29, 2020 9:19 PM
  • User475983607 posted

    Try removing the runat=server attribute.  Other than that I get markup that matches your original code.  Not sure what else I can do...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, January 29, 2020 9:21 PM
  • User475983607 posted

    Also on the html side it a blue squiggly line underneath  '<%=VideoUrl %>' on mouse over it reads "This is not a scriptlet. Will be output as plaintext."

    you want plain text.  Have you tried view the HTML source?  Perhaps share your code?

    Wednesday, January 29, 2020 9:23 PM
  • User-334723271 posted

    That was it, Thanks.

    Louie

    Wednesday, January 29, 2020 9:23 PM