Solved

How can find out if a datalist control has return no results?

Posted on 2008-06-16
1
159 Views
Last Modified: 2013-11-07
I have a datalist control that when some text box fields are filled out, a certain sql statement is executed and a query is populated.  

The results appear when the person hits a search that can populate results.  If there are no results to return i get no action.  I want to be able to check if the datalist rendered results or not.  
Protected Sub Search()
 
        Me.uxSearchDataList.DataSourceID = Me.uxSearchSqlDataSource.ID
 
        Dim sql as string = ""
 
        ..............
 
        Me.uxSearchSqlDataSource.SelectCommand = sql
 
    End Sub
 
    Protected Sub uxSearchButton_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
 
        Search()
 
    End Sub

Open in new window

0
Comment
Question by:mmedi005
[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
1 Comment
 
LVL 37

Accepted Solution

by:
samtran0331 earned 500 total points
ID: 21796290
Have you tried counting the datalist items?

        If uxSearchDataList.Items.Count = 0 Then
            'No items in datalist
        End If
0

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

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…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

756 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