在asp.net中的代码中动态分配vimeo的视频src [英] Dynamically assigned the video src of vimeo in code behind in asp.net

查看:138
本文介绍了在asp.net中的代码中动态分配vimeo的视频src的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个场景,在页面加载时我从数据库中获取用户ID并且必须在网页上显示他的电影,

i已经保存了数据库中每个用户的viemo视频网址,我我想知道如何将代码中的src分配给特定用户。



i have an scenario where on page load i get the user id from database and have to show his movie on the webpage,
i have saved the viemo video url of every user in the database, i want to know that how can i assign the src in code behind against the particular user.

<iframe src="//player.vimeo.com/video/91467577?title=0&amp;byline=0&amp;portrait=0&amp;color=ffffff" width="500" height="281" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>

推荐答案

在代码后面你需要有以下代码:



in code behind you need to have the following code:

protected void Page_Load(object sender, EventArgs e)
   {
       myIframe.Attributes["src"] = "http://www.youtube.com/watch?v=NEcZmT0fiNM&list=PLp12xt0S4J0UYXerKrIPCLTk15ZUzFdKz";
   }



并且您还需要通过将您的iframe更改为以下内容来使iframe可以在服务器端访问:




and Also you need to make iframe to be accessible in server side by changing yours to the following one :

<iframe src="//player.vimeo.com/video/91467577?title=0&byline=0&portrait=0&color=ffffff" width="500" height="281" frameborder="0">
        webkitallowfullscreen mozallowfullscreen allowfullscreen runat="server" ID="myIframe"></iframe> 



如果你看看我只将这两个属性添加到你的'runat =server'和ID =myIframe



希望有帮助


if you take a look I only added these two properties to yours 'runat="server"' and ID="myIframe"

hope it helps


这篇关于在asp.net中的代码中动态分配vimeo的视频src的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆