Solved

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

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

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…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

17 Experts available now in Live!

Get 1:1 Help Now