Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8
This is the forum to discuss the Wrox book Beginning ASP.NET 2.0 by Chris Hart, John Kauffman, David Sussman, Chris Ullman; ISBN: 9780764588501
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 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 September 5th, 2009, 04:58 PM
Registered User
 
Join Date: Sep 2009
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 6 Beginning ASP.NET 2.0 C# Error

It is on Page 191 and I can't figure out how to fix it.

protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
DataView row;
Image img;

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
row = (DataView)e.Item.DataItem;

if (row["PictureURL"].ToString().Trim() == "")
{
img = (Image)e.Item.FindControl("NewsImage");
img.Visible = false;
}
}
}

It is exact code from the book; however, it is giving me error message. "Argument '1': cannot convert from 'string' to 'int' for the 2nd if statement. Did i type something wrong??? I guess I don't even know really what this thing is talking about.
 
Old September 6th, 2009, 07:14 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Shouldn't it be a DataRowView instead of a DataView?

DataRowViews can be indexed by the index and by the column's name; DataViews only by an index....

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
Beginning ASP.NET 2.0 Chapter 4 page 111 gvecino BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 7 December 2nd, 2006 01:36 PM
Beginning ASP.NET using C# -- Chapter 2 Eric Smith BOOK: Beginning ASP.NET 1.0 1 October 9th, 2006 02:27 PM
Beginning ASP.NET 2.0 - Chapter 6 - page 196 warren_banks BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 September 2nd, 2006 08:21 AM
Beginning ASP.NET E-Commerce (ADO error) dianastudy3 All Other Wrox Books 3 July 30th, 2003 11:51 PM





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