Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2
This is the forum to discuss the Wrox book Professional ASP.NET 2.0 Server Control and Component Development by Dr. Shahram Khosravi; ISBN: 9780471793502
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 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 22nd, 2007, 02:35 PM
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Ch. 12 - SqlDataSource Designer Errors

Not sure if I'm missing something or what but I am getting an error with the sample code pertaining to Data Source Controls. When I open the Default.aspx page that has the CustomComponents.SqlDataSource control I get the following:

MySource:Property accessor 'ConnectionString' on object 'System.Web.UI.Design.WebControls.SqlDataSourceDes igner' threw the following exception:'Unable to cast object of type 'CustomComponents.SqlDataSource' to type 'System.Web.UI.WebControls.SqlDataSource'.' C:\Data\Development\Downloads\ASP.NET_controls\793 507allchapters\793507 ch12\793507 ch12\Code\ASPNET2DataSourceControlModel\Default.as px C:\...\ASPNET2DataSourceControlModel
Any help or suggestions are greatly appreciated.

thanks
L
 
Old April 3rd, 2007, 02:54 PM
Wrox Author
 
Join Date: Aug 2006
Location: , , .
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi, llealii,
  What you rightly mentioned, what you're getting is a design time error NOT a runtime error. In other words, the code should successfully run without error. The reason for this design time error is that the SqlDataSource control in the SqlDataSource.cs file is wrongly annotated with the following metadata attribute:

[DesignerAttribute("System.Web.UI.Design.WebControl s.SqlDataSourceDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]

If you remove this metadata attribute, the design time error you're getting should go away.

Cheers!
Shahram


-----------------------
Shahram Khosravi, Ph.D.
Author of Professional ASP.NET 2.0 Server Control and Component Development
 
Old April 11th, 2007, 11:14 AM
Registered User
 
Join Date: Mar 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dr. Khosravi,

So if I want design support for the custom control I would need to create a custom SqlDataSourceDesigner for it, right? which I don't seem to see any coverage of that subject in the book.

Since I need to have that design support and want to extend some functionality of the current SqlDataSource, I just derived from it. Now what I'm having problems with is the Enable paging option on the GridView. When I try check the "canpage" value of the base sqldatasource or my derived instance it is always false. But I only get an error when I try to set the Maximum Rows on the SqlCommand Object. Othewise the GridView handles the paging as normal.

It's probably something very simple that I'm missing but I don't see it. So a nudge in the right direction would be greatly appreciated.

Thanks
L







Similar Threads
Thread Thread Starter Forum Replies Last Post
Chp.12 'custom' SqlDataSource and paging studen77 BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 8 April 4th, 2007 05:49 PM
Chp.12 SqlDataSource.SelectCountCommand ??? studen77 BOOK: Professional ASP.NET 2.0 Server Control and Component Development ISBN: 978-0-471-79350-2 4 March 7th, 2007 02:50 PM
Errors on Chapter 12 example(12.8) sonnie ASP.NET 2.0 Professional 2 June 7th, 2006 10:55 AM
Designer Errors with CF API calls rodmcleay C# 2005 2 March 10th, 2006 01:19 AM
Ch. 4 & Ch. 12 athena BOOK: Beginning PHP, Apache, MySQL Web Development ISBN: 978-0-7645-5744-6 0 July 23rd, 2004 10:54 AM





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