Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 12th, 2010, 02:54 PM
Authorized User
 
Join Date: Apr 2010
Posts: 18
Thanks: 7
Thanked 0 Times in 0 Posts
Default ListItems, Items and item

Hi Imar,

I'm a bit rusty on my coding so could you tell me what each of the above are. I'm working on p115 and am particularly puzzled as to what a ListItem item is.

Thanks Bill
Reply With Quote
  #2 (permalink)  
Old April 12th, 2010, 03:02 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

A ListItem is an item tthat appears in a List control.

List controls include the DropDownList, ListBox, BulletedList and others.

A ListItem is defined with this markup:

<asp:ListItem Text="Some Text" Value="Some Value" />

I don't have the book here right now so I can't check the context, but I think that "ListItem item" simply refers to thing / an item that is a ListItem.

Does this help?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old April 13th, 2010, 11:24 AM
Authorized User
 
Join Date: Apr 2010
Posts: 18
Thanks: 7
Thanked 0 Times in 0 Posts
Default List Item and item

Hi Imar,

Thanks for the reply. My understanding is...

A ListItem is an element which is part of an asp control and an item is more C# specific. The code snippet I'm looking at iterates through a loop to find ListItems in a check box and is as follows...

foreach (ListItem item in CheckboxList1.Items)
{
(if item.Selected == true)..........

Its basically the first line and its many referances to Item item Items that threw me. Is my understanding correct. Are there many other types of item? Therefore is it specifying an item of type ListItem?

Thanks again Bill
Reply With Quote
  #4 (permalink)  
Old April 13th, 2010, 01:10 PM
Authorized User
 
Join Date: Apr 2010
Posts: 18
Thanks: 7
Thanked 0 Times in 0 Posts
Default Items items

Sorry Imar,

I've sussed it now.

item is a local variable which holds a ListItem. It all falls into place now. Sorry for the confusion.

Bill
Reply With Quote
  #5 (permalink)  
Old April 13th, 2010, 01:21 PM
Imar's Avatar
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Quote:
item is a local variable which holds a ListItem
Exactly. This would have worked as well:

foreach (ListItem whateverYouNameIt in CheckboxList1.Items)
{
(if whateverYouNameIt.Selected == true)..........


Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
The Following User Says Thank You to Imar For This Useful Post:
flapjack (April 13th, 2010)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
deselecting items in listbox after certain other item choosen. Hughesie78 Visual Basic 2005 Basics 22 March 23rd, 2009 08:32 AM
unselect all other items in listbox when certain item selected Hughesie78 Pro VB.NET 2002/2003 1 February 23rd, 2009 07:40 AM
problem with color of listitems when postback hertendreef ASP.NET 2.0 Professional 6 March 9th, 2008 11:00 AM
Different colors for listitems of radiobuttonlist mahulda General .NET 2 August 27th, 2004 08:17 AM
Want Combo Box first item if only 1 item markw707 Access 3 June 9th, 2004 04:03 PM



All times are GMT -4. The time now is 10:37 PM.


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