I need help hiding a data field in ASP.NET when it is null. Here's what I have so far:
<script runat="server" type="text/vb">
// target the id called test
var test = document.getElementById("test");
// if test is not empty, show
// else hide test
if (test.value != null){
document.getElementById("test").style.visibility = visible;
}else{
document.getElementById("test").style.visibility = hidden;
}
<p><asp:Label runat="server" id="test"><%# Eval("DBField")%></asp:Label></p>
Can someone please guide me on this? I keep encountering errors no matter what I try. I feel like it should be more straightforward...any suggestions would be appreciated.
Thank you in advance,