I have a FormView that displays user contents, both data, image and video. But if user content doesn't contain video content in database the video handle is displayed on FormView, so how do i hid video or image control if image or video doesn't exist?.
html
<asp:FormView ID="FormView1" runat="server" OnDataBound="FormView1_DataBound">
<ItemTemplate>
<asp:Image ID="Image3vi" Text='<%#Eval("ImageName1")%>' runat="server" src='<%#getSRCDD(Container.DataItem)%> ' Width="100%" class="imagepost img-rounded" alt="" ImageUrl='<%# ("../UserImage/") %>'/>
<video id="my-player" class="video-js" controls="controls" preload="auto" data-setup="{}" style="width:100%; height:323px">
<source src="<%# Eval("Path") %>" type="video/mp4">
<source src="<%# Eval("Path") %>" type="video/ogg">
<source src="<%# Eval("Path") %>" type="video/webm" >
<div class="vjs-no-js">
To view this video please enable JavaScript, and consider upgrading to a web browser that
<a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a>
</div>
</video>
</ItemTemplate>
</asp:FormView>
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
5 Points
13 Posts
How do i hid video player control in Formview if video or image content doesn't exist?
Mar 10, 2018 01:24 PM|Skyformat48|LINK
I have a FormView that displays user contents, both data, image and video. But if user content doesn't contain video content in database the video handle is displayed on FormView, so how do i hid video or image control if image or video doesn't exist?.
html
Contributor
6730 Points
2715 Posts
Re: How do i hid video player control in Formview if video or image content doesn't exist?
Mar 12, 2018 10:07 AM|Eric Du|LINK
Hi Skyformat48,
According to your description and code, i make a sample through your needs, please check the following sample code:
Sample Code:
Result:
Best Regards,
Eric Du
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.