video视频,想让其的source src绑定到数据库中的数据,怎么写?

cherishF21 2016-05-20 11:53:37
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<style type="text/css">
.auto-style4 {
width: 100%;
height: 887px;
} </style>

<link href="http://vjs.zencdn.net/5.8.8/video-js.css" rel="stylesheet"/>
<script src="http://vjs.zencdn.net/ie8/1.1.2/videojs-ie8.min.js"></script>

<div style="background-image: url(http://localhost:59228/Images/视频背景.jpg)"class="auto-style4">
<div align="left">
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/返回.png" PostBackUrl="~/xuexi/mycode/user/Contact.aspx" /> </div>

<div align="center">
<video id="video" class="video-js vjs-default-skin vjs-big-play-centered"
controls preload="auto" width="80%" height="80%"
poster="img/pure-black.jpg" data-setup=''>
<source src="../../../newm/<%# Eval("fileload") %>" type='video/mp4' />
<source src="../../../newm/<%# Eval("fileload") %>" type='video/webm' />
<source src="../../../newm/<%# Eval("fileload") %>" type='video/ogg' />
<p class="vjs-no-js">播放视频需要启用 JavaScript,推荐使用支持HTML5的浏览器访问。</p>
</video>
</div>


</div>
</asp:Content>
这是aspx,cs的是:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class xuexi_mycode_usermaster_video : System.Web.UI.Page
{
SqlHelper hp = new SqlHelper();
protected void Page_Load(object sender, EventArgs e)
{
hp.OpenDataBase();
string name = Request.QueryString["fileName"].ToString();
string sql = "select fileload from files where fileName='" + name + "'";
IDataReader dr = hp.GetDataReader(sql);
——————接下来怎么写好???——————————
}
}
...全文
918 8 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
System_FLAW 2017-12-20
  • 打赏
  • 举报
回复
<%="ss" %>改成<%=ss %>就行了,我正好也刚做到这!
cherishF21 2016-05-21
  • 打赏
  • 举报
回复
搞定了,要在cs里设置全局变量即在page_load之前,定义public string ss;
cherishF21 2016-05-21
  • 打赏
  • 举报
回复
引用 5 楼 fxj805835819 的回复:
[quote=引用 4 楼 cherishF21 的回复:]
[quote=引用 2 楼 fxj805835819 的回复:]
<source src="../../../newm/<%# Eval("fileload") %>" type='video/mp4' />

按照你的前台,你后台设置个变量public string fileload = string.Empty;给前台读取,然后dr["字段"].ToString()赋值给这个变量,前台<%=fileload %>

我在前台这么绑定数据可以吗?因为我的这个视频是用video-js.网上找的一款无需多写就能使用的视频,但是这个绑定我不大懂。[/quote]
<%=fileload %>这样的意思是读取后台fileload这个名字的变量
[/quote]

引用 5 楼 fxj805835819 的回复:
[quote=引用 4 楼 cherishF21 的回复:]
[quote=引用 2 楼 fxj805835819 的回复:]
<source src="../../../newm/<%# Eval("fileload") %>" type='video/mp4' />

按照你的前台,你后台设置个变量public string fileload = string.Empty;给前台读取,然后dr["字段"].ToString()赋值给这个变量,前台<%=fileload %>

我在前台这么绑定数据可以吗?因为我的这个视频是用video-js.网上找的一款无需多写就能使用的视频,但是这个绑定我不大懂。[/quote]
<%=fileload %>这样的意思是读取后台fileload这个名字的变量
[/quote]

不行啊,我然给你看看我写的代码
範先森 2016-05-21
  • 打赏
  • 举报
回复
引用 4 楼 cherishF21 的回复:
[quote=引用 2 楼 fxj805835819 的回复:] <source src="../../../newm/<%# Eval("fileload") %>" type='video/mp4' /> 按照你的前台,你后台设置个变量public string fileload = string.Empty;给前台读取,然后dr["字段"].ToString()赋值给这个变量,前台<%=fileload %>
我在前台这么绑定数据可以吗?因为我的这个视频是用video-js.网上找的一款无需多写就能使用的视频,但是这个绑定我不大懂。[/quote] <%=fileload %>这样的意思是读取后台fileload这个名字的变量
範先森 2016-05-20
  • 打赏
  • 举报
回复
<source src="../../../newm/<%# Eval("fileload") %>" type='video/mp4' /> 按照你的前台,你后台设置个变量public string fileload = string.Empty;给前台读取,然后dr["字段"].ToString()赋值给这个变量,前台<%=fileload %>
编程有钱人了 2016-05-20
  • 打赏
  • 举报
回复
IDataReader dr = hp.GetDataReader(sql); string ss=dr["字段"].ToString();
cherishF21 2016-05-20
  • 打赏
  • 举报
回复
引用 2 楼 fxj805835819 的回复:
<source src="../../../newm/<%# Eval("fileload") %>" type='video/mp4' /> 按照你的前台,你后台设置个变量public string fileload = string.Empty;给前台读取,然后dr["字段"].ToString()赋值给这个变量,前台<%=fileload %>
我在前台这么绑定数据可以吗?因为我的这个视频是用video-js.网上找的一款无需多写就能使用的视频,但是这个绑定我不大懂。
cherishF21 2016-05-20
  • 打赏
  • 举报
回复
引用 1 楼 wangjun8868 的回复:
IDataReader dr = hp.GetDataReader(sql); string ss=dr["字段"].ToString();
我试了后,出现在没有任何数据时进行无效的读取尝试的错误提醒。怎么回事呢,我的数据库里已经写好了内容。
飞趣社区开源版使用了hutool工具类作支撑,同时参考了zheng项目以及ruoyi的项目。页面ui使用了layui,集成了阿里云oss(支持前端和后端上传)、七牛云,支持代码自动生成,支持数据分离,减去了70%的工作量,让你更多的精力放在业务代码的过程。 飞趣社区使用java作为后端开发,使用springboot、mysql、druid、 mybatis、pagehelper、javamail、redis、beetl、hutool、layui、jeesuite、webmagic相关技术集成开发的一个web应用 并且支持爬虫、发邮件。 飞趣社区安装教程: 1、mysql创建一个数据 cwd_boring 2、导入sql sql目录下面的 3、安装redis 6379端口 飞趣社区使用说明: 1、使用jdk8 2、mysql 5.7 用户名密码 root root 3、配置文件里面为 application-dev.yml: feiqu-redis: servers: localhost:6379 #redis服务的ip和端口 password: mail: default-encoding: utf-8 host: smtp.qq.com #改成你的邮件主机 username: 123@qq.com #邮件服务 登陆用户名 password: 2333 #邮件服务 登陆密码 必须改为自己的配置才能生效 java类里面 com.feiqu.framwork.constant.CommonConstant.USER_ID_COOKIE com.feiqu.framwork.constant.CommonConstant.USER_COOKIE_SECRET com.feiqu.framwork.constant.CommonConstant.FORGET_PASSWORD_SECRET 必须改为自己的配置才能生效 4、ip2region.db -> \feiqu-opensource\feiqu-front\src\main\resources\ip2region\ip2region.db 转移到自己的文件位置 application-dev.yml:22 这个是参考的https://gitee.com/lionsoul/ip2region 大家也可以去 https://gitee.com/lionsoul/ip2region/blob/master/data/ip2region.db 下载最新的文件 然后放到对应的目录就可以了 5、com.feiqu.framwork.aspectj.DataSourceAspect 把注释去掉支持读分离 6、阿里云和七牛云的配置在——》feiqu-opensource\feiqu-front\src\main\resources\application.properties 七牛云 public.filesystem.provider=qiniu public.filesystem.bucketName=*** public.filesystem.urlprefix=*** public.filesystem.accessKey=*** public.filesystem.secretKey=*** picUrl = FileSystemClient.getPublicClient().upload(CommonConstant.FILE_NAME_PREFIX+currentTimeMillis+".jpg", img); 阿里云 aliyun.filesystem.bucketName=*** aliyun.filesystem.endpoint=*** aliyun.filesystem.accessKey=*** aliyun.filesystem.secretKey=*** aliyun.filesystem.urlprefix=*** 使用:videoUrl = FileSystemClient.getClient("aliyun").upload("video/"+fileName,localFile); 改成你要的 注意跨域和url_prefix 7、支持第三方登陆 现已集成了qq、微博 微信好像要钱就没弄。。。。 application.properties里面 app_id_qq=*** app_key_qq=*** app_id_sina=*** app_key_sina=*** 改成自己的就可以了 记得到qq互联之类的绑定自己的域名哦 https://connect.qq.com/?id=1 8、没有专门的后台 就直接放在前端了 把用户的角色 c

62,243

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧