Home > DeveloperSection > Forums > Hide div if Eval value of control is null
jayprakash sharma
jayprakash sharma

Total Post:117

Points:821
Posted on    March-24-2015 7:46 AM

 JavaScript JQuery  Mvc 
Ratings:


 1 Reply(s)
 562  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") %>'

 AutoAdjustImageControlSize="false" Width="300px"

 AlternateText='<%#Eval("PicName") %>' />

</div>



john rob

Total Post:108

Points:756
Posted on    March-24-2015 8:03 AM

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>


Don't want to miss updates? Please click the below button!

Follow MindStick