datalist item count

Posted on 2006-07-14
Last Modified: 2008-01-09
Hello experts,

I have a panel which displays;-

Your search query returned 0 Results.
if no result was returned. and a datalist bound to an objectdatasource

How do I determine that my datalist is empty so I can display the message like so;-

if (datalist is empty)
  panel1.visible = true
Question by:claracruz
  • 2
  • 2
LVL 10

Accepted Solution

orbulat earned 500 total points
ID: 17106534
how about?

datalist1.Items.Count == 0
LVL 10

Expert Comment

ID: 17106537
you can use datalist1.Items.Count == 0 or DataSet1.Tables[0].Rows.Count == 0

Expert Comment

ID: 17106615
 If IsNothing(datalist1) OrElse datalist1.Items.Count = 0 Then
            Response.Write("No records found")
   End If

Expert Comment

ID: 17106650
In c#
      if(datalist1==null  ||  datalist1.Items.Count == 0)
                        Response.Write("No records found");

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now