Solved

datalist item count

Posted on 2006-07-14
4
1,209 Views
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
}
0
Comment
Question by:claracruz
[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
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
orbulat earned 500 total points
ID: 17106534
how about?

datalist1.Items.Count == 0
0
 
LVL 10

Expert Comment

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

Expert Comment

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

Expert Comment

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

Featured Post

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

624 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