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

  • Thread starter Thread starter karim
  • Start date Start date
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
 
You will have to post come code.

Are you using another namespace that has a DataRowView?


bill
 
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>






 
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>
 
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
 
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.
 
Back
Top