?
Solved

Conditional statement in .aspx page

Posted on 2008-10-31
2
Medium Priority
?
715 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
[X]
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
2 Comments
 
LVL 16

Accepted Solution

by:
ororiole earned 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

770 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