Click here to Skip to main content
16,010,470 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In my application i want to play the video file stored in the datbase inside gridview.
if anyone have idea or link about this help me
Posted
Comments
Leo Chapiro 3-Sep-13 5:42am    
Sorry, I have not understood this one: "video file stored in the datbase inside gridview" ... Database inside grid view?

Inside GridView Add ItemTempalte and Inside ItemTemplate Use the Video tag, Object to play video.
Note:-Only Latest browser like Chrome,IE9 etc. are support video tag to play video.
Note:-ItemTemlate is a container in which you can put any element. like TextBox,DropDownlist,Image Tag,Video Tage etc...
 
Share this answer
 
try this.. :)

ASP.NET
<div>
       <asp:gridview id="grdData" runat="server" autogeneratecolumns="false" xmlns:asp="#unknown">
           <columns>
               <asp:templatefield headertext="Vedio">
                   <itemtemplate>
                       <video width="320" height="240" controls autoplay>
                   <source src="movie.ogg" type="video/ogg">
                    <source src="movie.mp4" type="video/mp4">
                   <object data="movie.mp4" width="320" height="240">
                   <embed width="320" height="240" src='<%#Eval("url")'>
                     </object>
                       </video>
                   </itemtemplate>
               </asp:templatefield>
           </columns>
       </asp:gridview>
   </div>



C#
protected void Page_Load(object sender, EventArgs e)
        {
            BindData();
        }

        public  void BindData()
        {
           DataTable dtGetData = new DataTable();

            String ConnString = ConfigurationManager.ConnectionStrings["ConnectionName"].ConnectionString;
            SqlDataAdapter adapter = new SqlDataAdapter();

            using (SqlConnection conn = new SqlConnection(ConnString))
            {
                adapter.SelectCommand = new SqlCommand("select url from tableName", conn);
                adapter.Fill(dtGetData);
            }

            grdData.DataSource = dtGetData;
            grdData.DataBind();
        }
 
Share this answer
 
v3
Comments
Nirav Prabtani 30-May-14 2:56am    
try updated solution

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