p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 3.5 Basics (http://p2p.wrox.com/forumdisplay.php?f=351)
-   -   DataRowView Type Not Defined (CH 14) (http://p2p.wrox.com/showthread.php?t=70487)

kmwilliams5 September 9th, 2008 07:57 AM

DataRowView Type Not Defined (CH 14)
 
When I try to complete the exercise for "Hooking into RowDataBound" in Chapter 14 (Beginning ASP.NET 3.5 - VB), I get an error that DataRowView is an undefined type. The intellisense doesn't list or recognize it either. Any ideas why? I am using VWD Express Edition.

        Select Case e.Row.RowType
            Case DataControlRowType.DataRow
                Dim myRowView As DataRowView = CType(e.Row.DataItem, DataRowView)
                If Not Convert.ToBoolean(myRowView("Authorized")) Then
                    e.Row.CssClass = "HighContrast"
End If

Imar September 9th, 2008 12:51 PM

Hi there,

Looked like you missed step 3 on page 491 that instructs you to add an Imports statement for the System.Data namespace.

BTW, if you post book related questions, can you post them in the book's own forum located here: http://p2p.wrox.com/forum.asp?FORUM_ID=386 ? Makes it easier for me and others to keep track of things. I now almost overlooked this post.

And can you please specify a page number or ASPX file name so I know where to look instead of skimming through the whole chapter? ;)

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.

kmwilliams5 September 9th, 2008 01:04 PM

Thank you very much! BTW nice book! I am enjoying it very much.

Kaisha

Imar September 9th, 2008 01:35 PM

You're welcome... Glad you like the book.

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.

eddiemcham April 23rd, 2009 12:42 PM

Same problem, but using C#
 
Hello,

I had the exact same problem as Kaisha, except I was using the C# version. Step 3 says:

Quote:

At the top of Code Behind of the document add the following line of code if you are using Visual Basic .NET:

Code:

Imports System.Data

By trial and error, I discovered that my Code Behind required a similar addition:

Code:

using System.Data;
Only then would the "Try It Out" exercise work properly for me. If it means anything, I am using VWD 2008 Express Edition.

Was this step listed somewhere earlier in the book and I just missed it somehow? It was not stated on page 491.

Great book overall, by the way. [:)]

I'm mostly ASP Classic and a smidgen of PHP ~ completely clueless about .NET but trying to get past that in advance of a major conversion project at work.

Thanks,
Eddie McHam

Imar April 25th, 2009 05:07 AM

Hi Eddie,

It looks like the default "using" statements have changed between the release version of VWB 2008 and the first service pack. Initially, a new WebForm would contain this code in C#
Code:


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

Now, when I add a new web form, I get this:
Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

As you can see, among others the System.Data statement is missing. Therefore, you now indeed need to add it manually as you figured out already. I'll have it added to the errata section of the book.

Cheers,

Imar


All times are GMT -4. The time now is 03:06 PM.

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