how to play .mp3 file by clicking the name of .mp3 file in gridview?in gridview all the name of .mp3 songs are available.i want if i will click the name of .mp3 file that mp3 song should play.please give instruction?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default8.aspx.cs" Inherits="Default8" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<object id="video" height="300" width="300" classid="CLSID:6bf52a52-394a-11d3-b153-00c04f79faa6" visible="true">
<param name="url" value="http://localhost:8222/WebSitePractice/Player/http://localhost:8222/WebSitePractice/Player/GUITAR.mp3"/> //here the value I need to pass this variable fileURL which is in cs page
<param name="sendplaystatechangeevents" value="true" />
<param name="autoStart" value="false"/>
<param name="playcount" value="9999" />
</object>
<br />
<asp:DataGrid ID="dgMusicList" runat="server" AutoGenerateColumns="False" OnItemCommand="dgMusicList_ItemCommand">
<Columns>
<asp:TemplateColumn HeaderText="PlayList">
<ItemTemplate>
<asp:Label ID="lblPlayList" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "FileName") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
<asp:ButtonColumn CommandName="PlayMusic" HeaderText="Play" Text="Play"></asp:ButtonColumn>
</Columns>
</asp:DataGrid>
</div>
</form>
</body>
</html>
.cs coding is
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class Default8 : System.Web.UI.Page
{
string fileURL, FileName;
SqlConnection cn = new SqlConnection(@"Data Source=.\sqlexpress;Initial Catalog=Q;Integrated Security=True");
protected void Page_Load(object sender, EventArgs e)
{
cn.Open();
SqlCommand cmd = new SqlCommand("SELECT FileName from Ring", cn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
dgMusicList.DataSource = ds;
dgMusicList.DataBind();
}
protected void dgMusicList_ItemCommand(object source, DataGridCommandEventArgs e)
{
if (e.CommandName == "PlayMusic")
{
FileName = ((Label)e.Item.Cells[0].FindControl("lblPlayList")).Text;
}
SqlCommand cmd = new SqlCommand("SELECT FileContent from Ring where FileName = '" +FileName.ToString()+ "'", cn);
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
fileURL = dr[0].ToString();
dr.Close();
}
}