I have some code that prints out databse values into a repeater control on an asp.net page. However, some of the values returned are null/blank - and this makes the result look ugly when there are blank spaces.
How do you do conditional logic in asp.net controls i.e. print out a value if one exists, else just go to next value.
I should also add - that I want the markup to be conditional also, as if there is no value I dont want a
tag either.
Here is a snippet of code below just to show the type of values I am getting back from my database. (It is common for Address 2 not to have a value at all).
<div id="results">
<asp:Repeater ID="repeaterResults" runat="server">
<ItemTemplate>
Company: <strong><%#Eval("CompanyName") %></strong><br />
Contact Name: <strong><%#Eval("ContactName") %></strong><br />
Address: <strong><%#Eval("Address1")%></strong><br />
<strong><%#Eval("Address2")%></strong><br />..................
Many thanks