Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I add this code. but it is usefull for one song.

ASPX

ASP.NET
<div>
<div id="audply"  runat="server" >
</div>


ASPX.cs (page load)

C#
audply.InnerHtml = "<embed src=\"Downloads/filename.mp3\" ></embed>";



[Agent_Spock]
- Added appropriate tag
Posted
Updated 29-May-14 22:39pm
v4
Comments
[no name] 29-May-14 13:54pm    
anyone please answer the problem.... please. its urgent.
ZurdoDev 29-May-14 15:28pm    
How will you allow them to chose the file?
[no name] 29-May-14 16:12pm    
by textbox. user can write the song name and they click on button after that the song will play
ZurdoDev 29-May-14 16:19pm    
One simple way would be to update the src attribute of your embed item. Add an id so you can get to it through jquery.
[no name] 29-May-14 16:21pm    
how? will you please tell me the steps...I have a little idea about jquery. Please.

1 solution

Aspx :
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        window.onload = function () {
            $("input[id$=btnChangeSong]").click(function (e) {
                e.preventDefault();
                $("[id$=audply]").html("<embed src=\"Downloads/" + $("[id$=txtSong]").val() + ".mp3\"></embed>");
            });
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:textbox runat="server" id="txtSong" xmlns:asp="#unknown"></asp:textbox>
            <asp:button runat="server" id="btnChangeSong" xmlns:asp="#unknown" />
            <div id="audply" runat="server">
        </div>
    </form>
</body>
</html>
</div>

Code behind :
C#
protected void Page_Load(object sender, EventArgs e)
{
    audply.InnerHtml = "<embed src=\"Downloads/5 Le petit soldat.mp3\"></embed>";
}
 
Share this answer
 
Comments
[no name] 31-May-14 13:55pm    
Thanks a lot....thanks..... :)
Ahmed Bensaid 31-May-14 13:56pm    
You're welcome ;)

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