Hi...
In aspx:
<asp:Label ID="lbltxt" runat="server" Text="Select Video file :" ForeColor="Brown" style="font-weight: 700"></asp:Label>
<asp:dropdownlist id="ddlvideo" runat="server" height="25px" appenddatabounditems="true" forecolor="DarkOliveGreen" onselectedindexchanged="DropDownList1_SelectedIndexChanged" width="170px" style="font-weight: 700" autopostback="True" xmlns:asp="#unknown"></asp:dropdownlist>
<asp:literal id="Literal1" runat="server" xmlns:asp="#unknown"></asp:literal>
In aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
con = new MySqlConnection(cs);
con.Open();
cmd1 = new MySqlCommand("select * from Videos", con);
cmd1.ExecuteNonQuery();
da = new MySqlDataAdapter(cmd1);
DataSet ds = new DataSet();
da.Fill(ds);
con.Close();
ddlvideo.DataSource = ds;
ddlvideo.Items.Add("--- Select Video File ---");
ddlvideo.DataValueField = "VideoNo";
ddlvideo.DataTextField = "VideoName";
ddlvideo.DataBind();
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
string surl = "Videos/" + ddlvideo.SelectedItem.Text;
if (surl == "Videos/" + "--- Select Video File ---")
{
ddllbl.ForeColor = Color.Red;
ddllbl.Font.Bold = true;
ddllbl.Text = "Pls Select Video File ";
Literal1.Visible = false;
}
else
{
bool isfullsize = false;
this.Literal1.Text = this.getvideo(surl, isfullsize);
}
}
private string getvideo(string surl, bool isfullsize)
{
string sobj = "";
surl = surl + "";
surl = surl.Trim();
if (surl.Length > 0)
{
}
else
{
throw new System.ArgumentNullException("surl");
}
sobj = sobj + "<object classid='clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6' id='Player1' height='379' width='500' standby='Please wait loading file...'>";
sobj = sobj + "<param name='url' value='" + surl + "' />";
sobj = sobj + "<param name='src' value='" + surl + "' />";
sobj = sobj + "<param name='uimode' value='full' />";
sobj = sobj + "<param name='AutoStart' value='true' />";
sobj = sobj + "<param name='ShowControls' value='1' />";
sobj = sobj + "<param name='ShowStatusBar' value='1' />";
sobj = sobj + "<param name='ShowDisplay' value='1' />";
sobj = sobj + "<param name='stretchToFit' value='1' />";
sobj = sobj + "<param name='enablecontextmenu' value='true' />";
sobj = sobj + "<param name='fullscreen' value='" + isfullsize.ToString() + "' />";
sobj = sobj + "</object>";
return sobj;
}
Thank u.