Javascript c#asp.net如何使用引导模式将视频源文件名添加到不同的媒体类型
我想使用javascript更新一个全局C#变量。我认为我不能这样做,因为javascript是客户端。我可以将视频的源文件名传递给javascript,但如何在模式中更新视频源标记?任何帮助都将不胜感激 这是我的密码: 观看视频。aspxJavascript c#asp.net如何使用引导模式将视频源文件名添加到不同的媒体类型,javascript,c#,twitter-bootstrap,modal-dialog,html5-video,Javascript,C#,Twitter Bootstrap,Modal Dialog,Html5 Video,我想使用javascript更新一个全局C#变量。我认为我不能这样做,因为javascript是客户端。我可以将视频的源文件名传递给javascript,但如何在模式中更新视频源标记?任何帮助都将不胜感激 这是我的密码: 观看视频。aspx <div class="table-responsive has-margin-bottom"> <asp:DataList ID="DataList2" runat="server" RepeatLayout="Table" Re
<div class="table-responsive has-margin-bottom">
<asp:DataList ID="DataList2" runat="server" RepeatLayout="Table" RepeatDirection="Horizontal" RepeatColumns="3"
Width="100%" OnItemDataBound="DataList2_ItemDataBound">
<ItemTemplate>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal"
data-videoname='<%# Eval("title") %>' data-videofile='<%= fileDirectory %><%# Eval("filename") %>' >
<img src='<%= fileDirectory %><%# Eval("filename") %>.png' class="img-responsive" />
<h3><%# Eval("title") %></h3>
</button>
</ItemTemplate>
</asp:DataList>
</div>
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog modal-lg" >
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel" ></h4>
</div>
<div class="modal-body">
<video id="video1" class="center-block" autoplay="autoplay" controls="controls" width="640" height="480" >
<source src="<%=videoFile %>.mp4" type="video/mp4" />
<source src="<%=videoFile %>.ogv" type="video/ogv" />
<source src="<%=videoFile %>.wmv" type="video/wmv" />
Video is not supported by your browser or computer
</video>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
这将在单击时将视频src更新为每个按钮的数据视频文件属性中的内容:
<button onclick="$('#video1 source').attr('src', $(this).data('videofile'));" class=...
要从服务器端数据videoFile变量更新客户端上的标记吗?我可以更新数据标记,让javascript脚本知道。我需要将javascript中的标记传递给模态。我可以做一些类似的事情(从getbootstrap.com示例中获取)来更新模式标题吗。我需要让他们知道你的代码不起作用的源信息。我尝试在母版页脚本中使用您的代码,但做了一些修改,但也没有成功。我在脚本的最后一行添加了以下内容:modal.find(“#video1 source”).attr('src',myFilename)有错误吗?当点击按钮时,它是否更新了底层HTML中的src?否,我放弃了,并使用asp.net上的ajaxcontrol从codebehind打开模式。无论如何谢谢你
<button onclick="$('#video1 source').attr('src', $(this).data('videofile'));" class=...