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 March 7th, 2010, 01:29 PM
Banned
 
Join Date: Jan 2010
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
 
Old March 7th, 2010, 01:33 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 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!





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 12:13 PM
quick question treasacrowe Classic ASP Databases 2 August 30th, 2004 08:27 AM





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