HIDE DIV IF EVAL VALUE OF CONTROL IS NULL

jayprakash sharma

Total Post:117

Points:821
Posted by  jayprakash sharma
JQuery  Mvc 
 870  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. john rob

    Post:108

    Points:756
    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>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!