Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using this code to play a video on click on link button in DataList

C#
protected void DataList1_ItemCommand1(object source, DataListCommandEventArgs e)
    {
        if (e.CommandName == "select")
        {


                embed1.Attributes.Add("src", @"http://~/Uploads4/");
                embed1.Attributes.Add("filename",e.CommandArgument.ToString());
                this.modal1.Show();



        }

    }





In aspx page code is like this


ASP.NET
<asp:Button runat="server" ID="hiddenTargetControlForModalPopup" Style="display: none" />
    <ajaxtoolkit:modalpopupextender ID="modal1" 
            TargetControlID="hiddenTargetControlForModalPopup" PopupControlID="Panel1" 
             runat="server" BehaviorID="bhvModel1">
    <asp:Panel ID="Panel1" runat="server" Height="346px" Width="553px">
    
    <object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" id="Player1">

        <param name="URL" value="http://localhost/Music.wmv">

        <param name="http://path_to_the_video">

        <param name="AutoStart" value="1">

        <param name="ShowControls" value="1">

        <param name="ShowStatusBar" value="1">

        <param name="ShowDisplay" value="1">

        <param name="stretchToFit" value="1">

        <embed runat="Server" id="embed1" type="application/x-mplayer2"

pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/" 

width="424" height="379" 

 autostart="1" showcontrols="1" showstatusbar="1">

</embed>

</object>
 </param></param></param></param></param></param></param>



all things are works when i paly video filename as c:/Wildlife.wmv
but when it fetch from database AS ~\Uploads4\Wildlife.wmv It does not paly.
if in data base i take C:/Wildlife.wmv then it paly by fetching from database.

~\Uploads4\Wildlife.wmv path inserted automatically from uploding a file.
What is the problem.
please help me.
thanks
Posted

1 solution

It has been done when using
embed1.Attributes.Add("filename",Server.MapPath(e.CommandArgument.ToString()));

instead of
embed1.Attributes.Add("filename",e.CommandArgument.ToString());
 
Share this answer
 

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