Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 Display Modes
  #1 (permalink)  
Old March 7th, 2010, 12:29 PM
Banned
 
Join Date: Jan 2010
Location: Michigan
Posts: 22
Thanks: 10
Thanked 0 Times in 0 Posts
Default Chapter 8 Quick VB question

On page 284 in the NavigateURL property, _navigateUrl is defined as an Object and then 'cast' using CType as a String. Why can't _navigateUrl be defined as a String? Is it because ViewState is a property object an thus the object has to be cast as a String to return it?

Chuck
Reply With Quote
  #2 (permalink)  
Old March 7th, 2010, 12:33 PM
Imar's Avatar
Wrox Author
Points: 71,558, Level: 100
Points: 71,558, Level: 100 Points: 71,558, Level: 100 Points: 71,558, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,000
Thanks: 79
Thanked 1,573 Times in 1,550 Posts
Default

Hi Chcuk,

Yes, that's correct. ViewState stores Objects which enables you to store any type of object in it (as long as it can be serialized). When you store it, you know you store, say, a string. So the underlying object is really a string, but exposed as an object (as ViewState only understands objects). In order to get it back as the type you're expecting, you need to cast it.

Hope this helps,

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
Reply


Thread Tools
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
One quick question helovamut BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 1 March 16th, 2009 10:16 AM
Quick Question! arcadium Java GUI 1 August 5th, 2008 02:16 AM
Quick Question for Author of Chapter 11 Wullie BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 July 16th, 2006 06:54 PM
another quick question andyhague XSLT 2 March 21st, 2006 11:13 AM
quick question treasacrowe Classic ASP Databases 2 August 30th, 2004 08:27 AM



All times are GMT -4. The time now is 02:32 AM.


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