Click here to Skip to main content
15,890,399 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Actually i am using HTML5 video control in my asp.net 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

XML
<asp:GridView ID="gvInbox" runat="server" Width="100%" AutoGenerateColumns="False" 
        onselectedindexchanged="gvInbox_SelectedIndexChanged" 
        onrowcommand="gvInbox_RowCommand" onrowdatabound="gvInbox_RowDataBound" 
        AllowPaging="True" PageSize="20" 
        onpageindexchanging="gvInbox_PageIndexChanging" ShowFooter="True">
        <PagerSettings
          position="Bottom"           
          pagebuttoncount="20" Mode="NextPrevious" NextPageText="Next" 
            PreviousPageText="Previ...."/>
         <pagerstyle backcolor="LightBlue"
          height="30px"
          verticalalign="Bottom" CssClass="cssPager"
          horizontalalign="Center"/>
          <FooterStyle HorizontalAlign="Center" Height="25px" VerticalAlign="Bottom" BackColor="ActiveBorder" />
        <AlternatingRowStyle  BackColor="#F6F6F6" />
        <Columns>
       
            <asp:TemplateField>
                <ItemTemplate>
                    <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>/
                                        </video>
</asp:Panel>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
Posted
Updated 14-Mar-14 22:17pm
v3

1 solution

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

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[^]
 
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