I have two different codes: one is null and the other is not null.
Code with null value (== empty):
<div class="col-xs-6">
<iframe style="width:868px; height:550px;" id="FileReload" src="/Account/GetPDF?NUM=101">
<html>
<head></head>
<body>
<pre style="word-wrap: break-word; white-space: pre-wrap;"></pre>
</body>
</html>
</iframe>
</div>
Code when not null (!= empty):
<div class="col-xs-6">
<iframe style="width:868px; height:550px;" id="FileReload" src="/Account/GetPDF?NUM=101">
<html>
<body style="background-color: rgb(38,38,38); height: 100%; width: 100%; overflow: hidden; margin: 0">
<embed width="100%" height="100%" name="plugin" id="plugin" src="http://localhost:49943/Account/GetPDF?NUM=101" type="application/pdf" internalinstanceid="74" title="">
</body>
</html>
</iframe>
</div>
Controller code:
public ActionResult GetPDF(int NUM)
{
//.Select Database
//.
//.
if (reader.HasRows)
{
//Check if it passes a null or not-null value
PDF = ((byte[])reader["File"]);
return new FileContentResult(PDF, "application/pdf");
}
}
When it is null, the iframe displays as white. If it is not null, it works fine. (I want to hide the iframe when the layout is white.)
Here is how it looks when the iframe is white:
https://i.stack.imgur.com/6TYhq.jpg
If the value is null, display a white iframe with specified width and height.(if == null -> hide the iframe)
How can I check if a value is null using JavaScript?