Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 1.1
This is the forum to discuss the Wrox book Beginning ASP.NET 1.1 with Visual C#.NET 2003 by Chris Ullman, John Kauffman, Chris Hart, Dave Sussman, Daniel Maharry; ISBN: 9780764557088
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.1 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 18th, 2004, 06:25 PM
Authorized User
 
Join Date: Jul 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help with checkboxes

Hi,

I'm having a little trouble understanding the code between the Sub Page_Load() and End Sub in Chapter 3's checkbox exercise. I would be grateful if someone could help explain it to me because the book isn't very thorough. Feel free to AIM me at: computertutor9

Thanks!

Kara

 
Old July 19th, 2004, 08:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Can you post your question so we can help?

 
Old July 19th, 2004, 10:24 PM
Authorized User
 
Join Date: Jul 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sure.

I don't understand "msg +=" and "msg = msg &"

Why would you want to state the contents of the variable msg twice. What do each of these two "msg"'s represent? And does the message variable change with each selected item?

Also, what's the point of the "lblCities.Text = msg" line?

Thanks.

Kara

 
Old July 20th, 2004, 06:18 AM
Registered User
 
Join Date: Jul 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

msg+= concatenates the contents of msg with whatever is on the other side of the equals sign.

I can't find a msg = msg & in the example, what line is it on?

lblCities.Text = msg; assigns the contents of msg (the cities that were chosen and then concatented with line breaks in between) to the the asp:Label in the body of the HTML with the id lblCities. At the start of the program lblcities has no text value and so is blank, it is only after submit has been clicked that you give it a value.

hope this helps.

Tom

 
Old July 20th, 2004, 07:40 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
Default

The reason that it's done that way is to 'loop' through the checkbox control and store all the cities checked into a variable instead of just one city. If you did not do it that way you would just get the last city checked no matter how many checks were before the last one checked.



 
Old July 23rd, 2004, 09:25 PM
Authorized User
 
Join Date: Jul 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK, I still have a little trouble with it. But the explanations helped. Thanks.

Kara






Similar Threads
Thread Thread Starter Forum Replies Last Post
Gridview with checkboxes kgaughan1 ASP.NET 2.0 Professional 0 February 11th, 2007 11:31 PM
Listboxes and Checkboxes vanguardmike Classic ASP Basics 2 January 2nd, 2007 05:28 PM
Using Checkboxes in datagrid ractim General .NET 2 September 21st, 2004 05:14 AM





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