Hide div if Eval value of control is null

Total Post:117

Points:821

JQuery  Mvc 
 1477  View(s)
Ratings:
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") %>'
 AutoAdjustImageControlSize="false"Width="300px"
 AlternateText='<%#Eval("PicName")%>' />
</div>

  1. 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")%>' />
    </div>

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

Answer

Please check, If you want to make this post sponsored

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