Wrox Programmer Forums
|
BOOK: Professional ASP.NET 2.0 AJAX ISBN: 978-0-470-10962-5
This is the forum to discuss the Wrox book Professional ASP.NET 2.0 AJAX by Matt Gibbs, Dan Wahlin; ISBN: 9780470109625
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 2.0 AJAX ISBN: 978-0-470-10962-5 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 4th, 2007, 05:17 PM
Registered User
 
Join Date: Jul 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error Listing 6-17 -Cannot implicitly convert type

I'm on chapter 6 and have done every example in the book and all have worked well. But, in listing 6-17 I'm receiving the following error.
  Cannot implicitly convert type 'System.Web.Script.Serialization.JavaScriptSeriali zer' to 'System.Web.Script.Serialization.JavaScriptConvert er'

This error occurs in the code that I have typed and the error also occurs in the code that I download from Wrox's website.

I would really like to get this working before I move forward. Is anyone else having this problem?

Any help is greatly appreciated.


Thanks
BarDev
 
Old July 4th, 2007, 09:15 PM
Registered User
 
Join Date: Jun 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have not tried this example, so this is just an educated guess from my reading only.

The GetAlbumJSON() method is typed to return an object, but the XmlInclude attribute upon it is forcing the XML serialization to produce the result to follow the XML schema of Album. This may be triggering some compilational need to have a converter to produce the JSON equivalent of Album when a JavaScriptSerializer is doing the serialization. ?

So one thing I would consider trying is to remove the XMLInclude attribute from this method and change its return type from object to Album. Also, make sure you did not have any converters specified in the chapter's web.config (those sections seem to have been all commented out).

Just a stab in the dark. Good luck.

 
Old July 5th, 2007, 11:01 AM
Registered User
 
Join Date: Jul 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry for the confusion. It seems the book and the downloaded code were both correct. After looking closer at my code, I noticed the type was JavaScriptConverter but it should have been JavaScriptSerializer.

Thanks for the reply. Next time I will look a little harder before I ask for help


Thanks





Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot implicitly convert type ... lcarpay ASP.NET 2.0 Basics 3 June 22nd, 2007 11:20 PM
ConfigSection Error - CS0029: Cannot implicitly co bigluzer BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 4 January 9th, 2007 12:37 AM
Listing 6-17 simonh ASP.NET 2.0 Professional 1 February 12th, 2006 02:07 PM
cant implicitly convert type int to bool muskaanbajaj BOOK: ASP.NET Website Programming Problem-Design-Solution 3 November 19th, 2005 04:57 PM
Cannot implicitly convert type int to bool muskaanbajaj General .NET 12 May 5th, 2005 03:57 AM





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