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
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
  • 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

Industry Leaders: 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

Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 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