Wrox Programmer Forums
|
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 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 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
 
Old April 12th, 2010, 03:02 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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!
 
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
 
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
 
Old April 13th, 2010, 01:21 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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!
The Following User Says Thank You to Imar For This Useful Post:
flapjack (April 13th, 2010)





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





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