*/ Presentation Page: */
<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 */
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)
{
}
private void bindrepeater()
{
if (string.IsNullOrEmpty(Request.QueryString["id"]))
{
}
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 */
CREATE TABLE [dbo].[video](
[id] [int] IDENTITY(1,1) NOT NULL,
[name] [varchar](100) NULL
) ON [PRIMARY]