显示的Windows媒体控制asp.net C#。 [英] Showing Windows media control asp.net c#.

查看:214
本文介绍了显示的Windows媒体控制asp.net C#。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景:我创建在用户上传的视频和路径存储在数据库中的Web应用程序。
我显示,包括视频和数据列表上item_command()事件我是导航的新形式(Webform2)这里我使用Windows Media Player控件播放视频数据列表。

问题是:Windows媒体播放器的控制没有显示的形式了。

这是我在哪里添加控件到页面。

 < D​​IV的风格=文本对齐:中心;垂直对齐:中间的>
        < CC1:Media_Player_Control ID =Media_Player_Control1=服务器HEIGHT =299pxWIDTH =542px/>
             < BR />< / DIV>

在这里,我指定的URL控制

 保护无效的Page_Load(对象发件人,EventArgs的发送)
    {
        长vidid = Convert.ToInt64(会话[VID]);该项目//获取ID被点击
        DataClasses1DataContext DB =新DataClasses1DataContext();
        变种VID =(从db.Videos v
                   其中,v.videoId == vidid
                   选择v.videoPath).FirstOrDefault();        Media_Player_Control1.MovieURL = vid.ToString();
    }


解决方案

在您的标记使用的例如

 < OBJECT ID =播放器HEIGHT =0WIDTH =0
CLASSID =CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6>
< /对象>

Scenario: I am creating a web app where a user uploads videos and its path is stored in database. I am showing data list that includes the videos and on item_command() event of that data list I am navigation to a new form (Webform2) where I am using Windows media player control to play that video.

The problem is: The windows media player control is not showing up in the form.

This is where I am adding the control to the page.

<div style="text-align: center; vertical-align: middle">
        <cc1:Media_Player_Control ID="Media_Player_Control1" runat="server" Height="299px" Width="542px" />
             <br />

</div>

Here I am assigning URL to the control

    protected void Page_Load(object sender, EventArgs e)
    {
        long vidid=Convert.ToInt64(Session["vid"]); //Getting id of the item that is clicked
        DataClasses1DataContext db = new DataClasses1DataContext();
        var vid = (from v in db.Videos
                   where v.videoId == vidid
                   select v.videoPath).FirstOrDefault();





        Media_Player_Control1.MovieURL = vid.ToString();


    }

解决方案

use this in your markup example link

<OBJECT ID="Player" height="0" width="0"
CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
</OBJECT>

这篇关于显示的Windows媒体控制asp.net C#。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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