Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 102177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:54:47+00:00 2026-05-11T00:54:47+00:00

I have some code that prints out databse values into a repeater control on

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T00:54:48+00:00Added an answer on May 11, 2026 at 12:54 am

    It’s going to be a pretty subjective one this as it completely depends on where and how you like to handle null / blank values, and indeed which one of those two you are dealing with.

    For example, some like to handle nulls at the database level, some like to code default values in the business logic layer and others like to handle default / blank values at the UI – not to mention the plethora of options in between.

    Either way my personal choice would be to make sure you display that no data was available for that field at the UI level to avoid confusion. At worst something along the lines of:

    <strong><% If (Eval('Address2').Length > 0) Then %><%#Eval('Address2')%><% Else %>No data available for Address 2<% End If %></strong><br /> 

    That way at least the user knows that no data is available, rather than not knowing if there has been some system / administrative error.

    Hope that helps 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 61k
  • Answers 61k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer I'm assuming you meant DbgClr not Clt and mdbg not… May 11, 2026 at 9:37 am
  • added an answer Multiplying by the inverse is faster. Compilers don't optimize this… May 11, 2026 at 9:37 am
  • added an answer First of all, when working with Ajax you don't need… May 11, 2026 at 9:37 am

Related Questions

I have some code that prints out databse values into a repeater control on
I have some code that gives a user id to a utility that then
I have some code that uses the shared gateway pattern to implement an inversion
I have some code that raises PropertyChanged events and I would like to be
I have some code that looks like: template<unsigned int A, unsigned int B> int
I have some code that generates image of a pie chart. It's a general
I have some code that effectively does this : File file = new File(C:\\Program
I have some code that I am putting in the code-behind of a master
I have some code that uses the Oracle function add_months to increment a Date
I have some code that produces a set of primary key values that I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.