PDA

View Full Version : session variables and hiding empty data fields/<TR>s


mangeloni
12-28-2002, 02:14 AM
I know that to hide empty data fields and the <TR> that contains them you must do...

<% if (rsName.Fields.Item("extension").Value != null) { %>
<TR>
<TD>Extension</TD>
<TD><%=(rsName.Fields.Item("extension").Value)%></TD>
</TR>
<% } %>

However, I am not getting the data from a Record Set but from a Session Variable - is there a way to modify the above code to accomodate this or is there other code altogether?

I have tried the following but I get a " 'Null' is undefined " error
<% if (Session("Session1").Value != Null) { %>
<tr>
<td><%= Session("Session1") %></td>
<td width="20">&nbsp;</td>
<td> <%= Session("Session2") %></td>
</tr>
<% } %>

Any help would be greatly appreciated.

-MAngeloni

miranda
12-29-2002, 02:49 AM
what about this?
<% if (Session("Session1").Value != '') { %>
<tr>
<td><%= Session("Session1") %></td>
<td width="20"> </td>
<td> <%= Session("Session2") %></td>
</tr>
<% } %>

whammy
12-29-2002, 06:56 PM
I think this is right:

<% if (Session("Session1") != '') { %>
<tr>
<td><%= Session("Session1") %></td>
<td width="20"> </td>
<td> <%= Session("Session2") %></td>
</tr>
<% } %>

There is no .Value for a Session variable in javascript server-side if I remember right (but I could be wrong, since I mainly code in VBScript server-side).