Why do I have to qualify 'DataRowView' with System.Data?

K

karim

I am getting the error below when I try to use DataRowView in my aspx page.
I am using the System.Data in my code behind. I even tried importing
system.Data in the aspx. I have to qualify it with System.Data to get it
going. Why is that?

Error Message:
The type or namespace name 'DataRowView' could not be found (are you
missing a using directive or an assembly reference?)

Karim
 
W

William F. Robertson, Jr.

You will have to post come code.

Are you using another namespace that has a DataRowView?


bill
 
W

William F. Robertson, Jr.

Yes, you have to do it that way. There is no using for an aspx page. When
a page is compiled all the "using" goes away and is replaced with the full
name of all the objects.

The using is just to help with typing and maintaining more readable code.

There is no other way around it. (That I can think of)

HTH,

bill


karim said:
You will have to post come code.

Are you using another namespace that has a DataRowView?


bill

This is line from the aspx file:

<asp:TextBox id=txtCarName Width="340px" runat="server" text='<%# ( (
System.Data.DataRowView ) Container.DataItem ) [ "AutoName" ]
%>'></asp:TextBox>






 
K

karim

You will have to post come code.

Are you using another namespace that has a DataRowView?


bill

This is line from the aspx file:

<asp:TextBox id=txtCarName Width="340px" runat="server" text='<%# ( (
System.Data.DataRowView ) Container.DataItem ) [ "AutoName" ]
%>'></asp:TextBox>
 
M

MikeB

William F. Robertson said:
Yes, you have to do it that way. There is no using for an aspx page. When
a page is compiled all the "using" goes away and is replaced with the full
name of all the objects.

You should be able to use the

<%@ Import Namespace="System.Data" %>

directive to declare that the page is 'using' (in C# parlance) the
System.Data namespace.

The using is just to help with typing and maintaining more readable code.

There is no other way around it. (That I can think of)

HTH,

bill


karim said:
You will have to post come code.

Are you using another namespace that has a DataRowView?


bill

This is line from the aspx file:

<asp:TextBox id=txtCarName Width="340px" runat="server" text='<%# ( (
System.Data.DataRowView ) Container.DataItem ) [ "AutoName" ]
%>'></asp:TextBox>






I am getting the error below when I try to use DataRowView in my aspx
page.
I am using the System.Data in my code behind. I even tried importing
system.Data in the aspx. I have to qualify it with System.Data to get it
going. Why is that?

Error Message:
The type or namespace name 'DataRowView' could not be found (are you
missing a using directive or an assembly reference?)

Karim
 
D

David Waz...

You DON"t have to do it that way.

import the system.Data namespace in your code
or set it as a project-level import in project properties.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top