Click here to Skip to main content
14,489,038 members
Rate this:
Please Sign up or sign in to vote.
See more:
Actually i am using HTML5 video control in my web form .here in my my web form i am having a gridview in that i placed a HTML5 video control now my task is to bind url dynamically in row databound

1.) I want to find the HTML5 control in gridview
2.)I want to assign src dynamically in rowdatabound

Is it possible. below is my code

<asp:GridView ID="gvInbox" runat="server" Width="100%" AutoGenerateColumns="False" 


        onrowcommand="gvInbox_RowCommand" onrowdatabound="gvInbox_RowDataBound" 

        AllowPaging="True" PageSize="20" 

        onpageindexchanging="gvInbox_PageIndexChanging" ShowFooter="True">


          pagebuttoncount="20" Mode="NextPrevious" NextPageText="Next" 

         <pagerstyle backcolor="LightBlue"


          verticalalign="Bottom" CssClass="cssPager"

          <FooterStyle HorizontalAlign="Center" Height="25px" VerticalAlign="Bottom" BackColor="ActiveBorder" />
        <AlternatingRowStyle  BackColor="#F6F6F6" />
                    <asp:Panel ID="pnlMsg"  runat="server"   >
<asp:ImageButton ID="ImageButton1"  runat="server"  ImageAlign="Left"  

                                         ImageUrl='<%# Eval("BodyImageUrl").ToString() %>' CssClass="ClsImg"   Visible="false" CommandName="EnlImg" 

                                         CommandArgument='<%# Eval("BodyImageUrl").ToString() %>' />
<video id="Video" width='300' height='200' controls>
                                        <source src="" type="video/mp4"/>
                                        <p>Fallback code if video isn't supported</p>/
Updated 14-Mar-14 22:17pm

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

You can add runat="server" attribute and use the FindControl method as usual in the RowDataBound of GridView and set the src.

Or if the source is stored in the DB then you can set it in the MarkupCode itself like

src="<%# Eval("videosource") %>"

Check this Article which may be helpful

Display A List Of Audio / Video Files Using HTML5 And GridView[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100