Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > BOOK: Professional ASP.NET 2.0 AJAX ISBN: 978-0-470-10962-5
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 Search this Thread Display Modes
  #1 (permalink)  
Old July 4th, 2007, 05:17 PM
Registered User
 
Join Date: Jul 2007
Location: Castle Rock, CO, USA.
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
Reply With Quote
  #2 (permalink)  
Old July 4th, 2007, 09:15 PM
Registered User
 
Join Date: Jun 2007
Location: Portland, Oregon, USA.
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.

Reply With Quote
  #3 (permalink)  
Old July 5th, 2007, 11:01 AM
Registered User
 
Join Date: Jul 2007
Location: Castle Rock, CO, USA.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
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



All times are GMT -4. The time now is 01:58 AM.


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