Click here to Skip to main content
16,013,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi everyone
how i can show video in asp.net
any tools to do it
plz name or link for this
from where i can get windows media player for asp.net any link any way to add

thanks for anyhelp
Posted
Updated 18-Feb-11 22:30pm
v2

Hope Display Video[^] might help you.
 
Share this answer
 
Comments
Mostafa Elsadany 19-Feb-11 3:14am    
thanks for help
[no name] 19-Feb-11 5:23am    
My Pleasure
Espen Harlinn 19-Feb-11 10:45am    
Good link :)
[no name] 20-Feb-11 22:40pm    
Thanks Espen.
 
Share this answer
 
Comments
Espen Harlinn 19-Feb-11 10:44am    
Good links :)
Abhinav S 19-Feb-11 10:49am    
Thanks Espen.
 
Share this answer
 
Comments
Espen Harlinn 19-Feb-11 10:44am    
Good links :)
*/ Presentation Page: */
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head  runat="server">
    <title></title>
     <style type="text/css">
    .floating
    {
        float:left;
        margin-left:80px;
        height:310px;
        width:310px;
       
        padding:10px;
    }
    </style>
</head>
<body>
    <form id="form1"  runat="server">
    <div>
        <asp:gridview id="GridView1" runat="server" autogeneratecolumns="False" xmlns:asp="#unknown">
            DataSourceID="SqlDataSource1" BackColor="#CCCCCC" BorderColor="#999999" 
            BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" 
            ForeColor="Black">
            <columns>
                <asp:templatefield headertext="Welcome Here are few Uploads Done by you!!">
                    <itemtemplate>
                        <asp:hyperlink id="HyperLink1" runat="server">
                            NavigateUrl='<%# Eval("id", "~/Default5.aspx?id={0}") %>' 
                            Text='<%# "Click Here to Play Video"+ Eval("id") %>' ondatabinding="HyperLink1_DataBinding"></asp:hyperlink>
                    </itemtemplate>
                </asp:templatefield>
            </columns>
            <footerstyle backcolor="#CCCCCC" />
            <headerstyle backcolor="Black" font-bold="True" forecolor="White" />
            <pagerstyle backcolor="#CCCCCC" forecolor="Black" horizontalalign="Left" />
            <rowstyle backcolor="White" />
            <selectedrowstyle backcolor="#000099" font-bold="True" forecolor="White" />
            <sortedascendingcellstyle backcolor="#F1F1F1" />
            <sortedascendingheaderstyle backcolor="#808080" />
            <sorteddescendingcellstyle backcolor="#CAC9C9" />
            <sorteddescendingheaderstyle backcolor="#383838" />
        </asp:gridview>
        <asp:sqldatasource id="SqlDataSource1" runat="server" xmlns:asp="#unknown">
            ConnectionString="<%$ ConnectionStrings:examConnectionString %>" 
            SelectCommand="SELECT * FROM [video]"></asp:sqldatasource>
    </div>
    <div>
        <asp:repeater id="Repeater1" runat="server" xmlns:asp="#unknown">
        <itemtemplate>
         <object id="MediaPlayer" width="270" height="270">
            CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"  STANDBY="Loading Windows Media Player components..."
            TYPE="application/x-oleobject"><param name="autoplay" value="true">
            <param name="width" value="270">
            <param name="height" value="270">
            <param name="FileName" value="<%#">></param></param></param></param></object>
        </itemtemplate>
        </asp:repeater>
    </div>
    </form>
</body>
</html>


*/ Code Behind Page */
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Web.Configuration;
using System.Web.UI.HtmlControls;

public partial class Default5 : System.Web.UI.Page
{
    SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["con"].ConnectionString);

    protected void Page_Load(object sender, EventArgs e)
    {
      //  GetData();
       
    }
   
    private void bindrepeater()
    {
        //Request.QueryString["id"].ToString();
        if (string.IsNullOrEmpty(Request.QueryString["id"]))
        {
            // Response.Write("Please Select User to Get Data");
        }
        else
        {
            SqlCommand cmd = new SqlCommand("select name from video where id=@id", con);
            cmd.Parameters.AddWithValue("@id", Request.QueryString["id"]);
            DataSet ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(ds);
            Repeater1.DataSource = ds;
            Repeater1.DataBind();
        }
    }
    public string grtdata()
    {
        SqlCommand cmd = new SqlCommand("select name from video", con);
        con.Open();
        SqlDataReader dr = cmd.ExecuteReader();
        dr.Read();


        string filename = dr[0].ToString();
        string path = "~/Videos/";
        string opath = Server.MapPath(path);

        dr.Close();
        con.Close();
        return opath;
    }
    protected void HyperLink1_DataBinding(object sender, EventArgs e)
    {
        bindrepeater();
    }
}

/* Database Script */

SQL
CREATE TABLE [dbo].[video](
	[id] [int] IDENTITY(1,1) NOT NULL,
	[name] [varchar](100) NULL
) ON [PRIMARY]
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900