Solved

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

Posted on 2008-06-16
1
154 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
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

757 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

19 Experts available now in Live!

Get 1:1 Help Now