Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
|
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 September 26th, 2003, 05:03 AM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to life_s Ng Send a message via MSN to life_s Ng
Default hi, some question bout condition of Dropdownlist..

hi, i got a dropdown list whic bind to a database field, and, if there is listitem inside the dropdownlist, i need to do something, if not, i'll do something else...

here is my code,

                dim objCmd1 as OleDbCommand = new OleDbCommand("SELECT SentTime FROM Instructions WHERE Status ='" & Outstanding & "'", Conn1)
                        dim objReader1 as OleDbDataReader

                        objCmd1.Connection.Open()
                         objReader1=objCmd1.ExecuteReader
                         DdlInstructList.DataSource = objReader1
                         DdlInstructList.DataBind()
                         objReader1.Close
                        objCmd1.Connection.Close()

                  if DdlInstrucList........


the problem is... i dont know how can i check is there any listitem inside the dropDownList... can any1 show me the way to check it? or provide some documentation? thanks!

Best Regards
life's Ng

 
Old September 26th, 2003, 02:13 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

DdlInstructList.Items.Count will return you the count of the items in the dropdownlist.

ListItemCollection "Items" is a member of the DropDownList. (sorry, These were links to a framework browser, but they didn't work apparently.)

Peter
 
Old September 26th, 2003, 02:43 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Ok, apparently the links do work, but only if they are not used in the "Forum Code" url tag.

Here are the links that were originally there:

DropDownList:
http://docs.aspng.com/quickstart/asp...s=DropDownList

ListItemCollection:
http://docs.aspng.com/quickstart/asp...ItemCollection

Peter
 
Old September 26th, 2003, 10:26 PM
Friend of Wrox
 
Join Date: Aug 2003
Posts: 108
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to life_s Ng Send a message via MSN to life_s Ng
Default

yeah thanks alot Peter! here is the code that im using it.

if DdlInstructList.Items.Count>0
.....
else
.....
end if






Similar Threads
Thread Thread Starter Forum Replies Last Post
about DropDownList question jason_lai ASP.NET 2.0 Basics 3 June 5th, 2007 08:40 PM
how to bout data from execel to sqlserver2000 zizo2120 Pro VB Databases 0 April 3rd, 2007 08:12 AM
NEWBIE Question: Expected "" in search condition aasiddle SQL Language 5 March 19th, 2007 03:49 PM
NEWBIE Question: Expected "" in search condition aasiddle ASP.NET 2.0 Basics 0 March 4th, 2007 11:21 AM
Question about counting records based on condition TheBlueSky Crystal Reports 1 May 31st, 2006 03:35 AM





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