Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在HTML中使用vb.net每月播放一个视频_Vb.net - Fatal编程技术网

在HTML中使用vb.net每月播放一个视频

在HTML中使用vb.net每月播放一个视频,vb.net,Vb.net,我有一个使用vb.net的web应用程序。应用程序始终播放视频循环。我需要每月手动更改视频。我怎样做才能随着月份的变化自动更改视频 我有以下HTML代码: <!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <title>Fullscreen

我有一个使用vb.net的web应用程序。应用程序始终播放视频循环。我需要每月手动更改视频。我怎样做才能随着月份的变化自动更改视频

我有以下HTML代码:

<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Fullscreen Video</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="Style.css">
</head>
<body>

    <div class="fullscreen-bg">
        <video id="video1" muted autoplay class="fullscreen-bg__video">
            <source src="http://euspsql01/prevencion/video/6.mp4"  type="video/mp4">
            </video>
    </div>

    <div class="content">


    </div>

</body>
</html>
<script type='text/javascript'>

    document.getElementById('video1').addEventListener('ended', myHandler, false);


    function myHandler(e) {
        window.location.href = "http://euspsql01/Prevencion";
    }

</script>

在HTML中需要一个服务器控件。我会使用文字:

<video id="video1" muted autoplay class="fullscreen-bg__video">
    <asp:Literal ID="litSource" runat="server" />
</video>

然后在Page_Load事件期间填充该值

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim VideoUrl As String="http://euspsql01/prevencion/video/" & Today.Month & ".mp4"
    litSource.Text = "<source src=""" & VideoUrl & """  type=""video/mp4"">"
End Sub
Protected Sub Page_Load(ByVal sender作为对象,ByVal e作为System.EventArgs)处理Me.Load
Dim VideoUrl作为字符串=”http://euspsql01/prevencion/video/“&Today.Month&.mp4”
litSource.Text=“”
端接头

其他选项是将runat=“server”放入当前源元素并设置.Attributes(“src”)=VideoUrl,但这会产生更多HTML。

Public mes As String=Today.Month
您在这里遇到了问题。Month返回一个整数,而不是字符串。请打开选项“严格”。这是一个由两部分组成的过程。首先,对于当前项目-在解决方案资源管理器中双击“我的项目”。选择左边的Compile。在“选项严格”下拉列表中,选择“启用”。第二,对于未来的项目-进入工具菜单->选项->项目和解决方案->VB默认值。在“选项严格”下拉列表中,选择“启用”。这将使您在运行时免受bug的困扰。这也是一个问题<代码>公共rutavideo As String=“Http://euspsql01/prevencion/video/“And mes And”.mp4”vb.net中的连接字符是与(&)Try
“Http://euspsql01/prevencion/video/&mes&“.mp4”
一旦解决了第一个问题。
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim VideoUrl As String="http://euspsql01/prevencion/video/" & Today.Month & ".mp4"
    litSource.Text = "<source src=""" & VideoUrl & """  type=""video/mp4"">"
End Sub