Hide div if Eval value of control is null

Total Post:117

JQuery  Mvc 
 1431  View(s)
Rate this:

Is there a way to hide the div containing the RadBinaryImage if the bind value "Pic" is null? 

<div class="photo-container">
 <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" DataValue='<%# Eval("Pic") ==DBNull.Value? new System.Byte[0]: Eval("Pic") %>'
 AlternateText='<%#Eval("PicName")%>' />

  1. Post:108

    Re: Hide div if Eval value of control is null

    You can do it like this.

    visible attribute will return false if the value is null and it will return true if the value is not null.

    <div class="photo-container" visible='<%#Eval("Pic") == DBNull.Value ? false : true %>'>
     <telerik:RadBinaryImage runat="server" ID="RadBinaryImage1" DataValue='<%#Eval("Pic") == DBNull.Value? new System.Byte[0]: Eval("Pic") %>'
     AutoAdjustImageControlSize="false" Width="300px"
     AlternateText='<%#Eval("PicName")%>' />

      Modified On Apr-09-2018 02:31:32 AM


Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.