Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Conditional statement in .aspx page

Posted on 2008-10-31
2
710 Views
Last Modified: 2010-04-21
I have a page where I am pulling data from a table and want to show contact information for everyone that is pulled. However, not everyone has all the information that I am going to show.  In my code behind I have a dataset, setup public variables and then use them in my page. How can I make it so in the example below the word Email: ...... only shows if there is email information? Basically I need an If Else statement in my main page. Here is how I am getting the values from the table:

commEmail = dsvss.Tables(0).Rows(0).Item("email")



h2>Committee Officers</h2>
		       <h3><%=commtitle%></h3>
                <p class="ofc"><b><%=commFullName%></b><br />
                <%=commCompany%><br />
                <%=commAddress1%><br />
                <%=commAddress2%><br />
                <%=commCity%>,&nbsp;<%=commState%>&nbsp;&nbsp;<%=commZip%><br>
                Phone:&nbsp;&nbsp;<%=commPhone%><br />
                FAX:&nbsp;&nbsp;<%=commFax%><br />
                Email:&nbsp;&nbsp;<a href="mailto:<%=commEmail%>"><%=commEmail%></a><br />
                Website:&nbsp;&nbsp;<a href="http://<%=commWebsite%>" target="_blank"><%=commWebsite%></a><br />
                Term:&nbsp;&nbsp;<%=commTerm%></p>

Open in new window

0
Comment
Question by:flukester
2 Comments
 
LVL 16

Accepted Solution

by:
ororiole earned 500 total points
ID: 22855321
Like this!
I made the example shorter to make it simpler because I did test it, but it is your code other than that.
      <h3><%=commtitle%></h3>
                <b><%=commFullName%></b><br />
                <%=commCompany%><br />
                <%=commAddress1%><br />
 
<% If Not commEmail Is Nothing And Not commEmail = String.Empty Then
%>
Email:&nbsp;&nbsp;<a href="mailto:<%=commEmail%>"><%=commEmail%></a><br />
 
<%End If %>

Open in new window

0
 

Author Closing Comment

by:flukester
ID: 31512211
Thanks ororiole
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
parsing JSON help 1 20
How to seperate number and letters from a string 3 22
jquery tab header text 1 22
vb.net convert long time to mm:ss 23 11
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question