Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 1st, 2003, 09:36 AM
Authorized User
 
Join Date: Jun 2003
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default add conditional DataList item

Hi,

I'm sure this is really simple but I don't know the exact syntax to do this: all I want to do is, if items.count = 0 then add a list item "no items assigned". Below is my code:

         Finally
            If Not dr Is Nothing Then
               dr.Close()
            End If

            If lstSysProfile.Items.Count > 0
               lstSysProfile.Visible = True
            Else
               lstSysProfile.Visible = False
            End If
         End Try

Thanks!

John
 
Old July 1st, 2003, 01:10 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to NotNowJohn
Default

Code:
If (lstSysProfile.Items.Count = 0) Then
    lstSysProfile.Items.Add(New ListItem("No items associated"))
End If
...but the Soon is eclipsed by the Moon





Similar Threads
Thread Thread Starter Forum Replies Last Post
Aligning Header & Item DataList Templates rsearing ASP.NET 2.0 Basics 2 October 5th, 2007 06:09 AM
How to delete an item of a xml file from datalist? MTLedari ASP.NET 2.0 Professional 0 April 23rd, 2007 03:27 PM
Conditional Formatting on Embedded Item MCuthill ASP.NET 2.0 Basics 0 September 13th, 2006 12:31 PM
Show item in datalist control keyvanjan ASP.NET 1.0 and 1.1 Professional 0 January 14th, 2006 03:44 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.