473,394 Members | 1,444 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Language in Page directive in VS 2005

I'm using VS 2005 Beta 2.

In VS 2003, the Page directive in an aspx page has Language and
CodeBehind attributes. You can have the language be different than the
code behind file language. For instance, you can have

Language="vb"
CodeBehind="classA.cs"

In VS 2005, the CodeBehind attribute seems to have been replaced with
the CodeFile attribute, although this is not documented in the beta
documentation. Therefore, it becomes

Language="vb"
CodeFile="classA.cs"

This causes a compile error:

"The language of the code file is inconsistent with the language of the
page."

According to the documentation for both VS 2003 and VS 2005, the
Language directive is supposed to be the language embedded in the aspx
page. Therefore, I should be able to have a Language that is different
from the CodeFile page in VS 2005.

Why do I get this error? Is there a way to have a language for the page
be different from the code file language?

Nov 19 '05 #1
2 1632
Hi rjack,

Welcome to ASPNET newsgroup.
As for the programming Lanugage for ASP.NET 2.0 page,'s aspx file and
codebehind file, here are some of my understanding:

Yes, as you've found for the current asp.net 2.0 page model, we are forced
to use the same programming language for aspx page and codebehind class.
This is because in asp.net 2.0, we 're using the partial class for asp.net
page. The .aspx file and codebehind File are of the same class, so that
they're compiled into the same class at dynamic compilation. So the class
declaration in codebehind file is

public partial class mdpage : System.Web.UI.Page
btw, in asp.net 1.x ,the code behind class and aspx page is compiled into
different class, they're parent/child class relation (aspx generated class
derived from the codebehind class). that's why they can use different
language to program while it is not allowed in the 2.0 model.

In fact, the 2.0's partial class model has bring much more good features
than the old one, for example, we don't need to explicitly declare member
field for control instances in codebeind file....

Here are the msdn reference which demonstrate the page compilation model
change from beta1 to beta2:

#Changes for Beta 2
http://msdn.microsoft.com/asp.net/be...ta2update.aspx

You can also find some other article on asp.net 2.0 's beta feature
change/postpone or beta2 to RTM changes.

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| From: rj***@elegancetech.com
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Subject: Language in Page directive in VS 2005
| Date: 29 Sep 2005 13:07:26 -0700
| Organization: http://groups.google.com
| Lines: 29
| Message-ID: <11**********************@f14g2000cwb.googlegroups .com>
| NNTP-Posting-Host: 68.81.183.207
| Mime-Version: 1.0
| Content-Type: text/plain; charset="iso-8859-1"
| X-Trace: posting.google.com 1128024452 10674 127.0.0.1 (29 Sep 2005
20:07:32 GMT)
| X-Complaints-To: gr**********@google.com
| NNTP-Posting-Date: Thu, 29 Sep 2005 20:07:32 +0000 (UTC)
| User-Agent: G2/0.2
| X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
.NET CLR 1.0.3705; .NET CLR 1.1.4322; Alexa Toolbar; .NET CLR
2.0.50215),gzip(gfe),gzip(gfe)
| Complaints-To: gr**********@google.com
| Injection-Info: f14g2000cwb.googlegroups.com; posting-host=68.81.183.207;
| posting-account=egBesgwAAADr2AGpmzETviTrt74lbz3H
| Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!nntp.giganews. com!postnews.google.com!f1
4g2000cwb.googlegroups.com!not-for-mail
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:128088
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I'm using VS 2005 Beta 2.
|
| In VS 2003, the Page directive in an aspx page has Language and
| CodeBehind attributes. You can have the language be different than the
| code behind file language. For instance, you can have
|
| Language="vb"
| CodeBehind="classA.cs"
|
| In VS 2005, the CodeBehind attribute seems to have been replaced with
| the CodeFile attribute, although this is not documented in the beta
| documentation. Therefore, it becomes
|
| Language="vb"
| CodeFile="classA.cs"
|
| This causes a compile error:
|
| "The language of the code file is inconsistent with the language of the
| page."
|
| According to the documentation for both VS 2003 and VS 2005, the
| Language directive is supposed to be the language embedded in the aspx
| page. Therefore, I should be able to have a Language that is different
| from the CodeFile page in VS 2005.
|
| Why do I get this error? Is there a way to have a language for the page
| be different from the code file language?
|
|

Nov 19 '05 #2
Hi rjack,

How are you doing on this issue and does the information in my last reply
helps a littile? If there're anything else we can help, please feel free to
post here.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
--------------------
| X-Tomcat-ID: 83793527
| References: <11**********************@f14g2000cwb.googlegroups .com>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: st*****@online.microsoft.com (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Fri, 30 Sep 2005 05:43:51 GMT
| Subject: RE: Language in Page directive in VS 2005
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| Message-ID: <ue*************@TK2MSFTNGXA01.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Lines: 101
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:128172
| NNTP-Posting-Host: tomcatimport2.phx.gbl 10.201.218.182
|
| Hi rjack,
|
| Welcome to ASPNET newsgroup.
| As for the programming Lanugage for ASP.NET 2.0 page,'s aspx file and
| codebehind file, here are some of my understanding:
|
| Yes, as you've found for the current asp.net 2.0 page model, we are
forced
| to use the same programming language for aspx page and codebehind class.
| This is because in asp.net 2.0, we 're using the partial class for
asp.net
| page. The .aspx file and codebehind File are of the same class, so that
| they're compiled into the same class at dynamic compilation. So the class
| declaration in codebehind file is
|
| public partial class mdpage : System.Web.UI.Page
|
|
| btw, in asp.net 1.x ,the code behind class and aspx page is compiled into
| different class, they're parent/child class relation (aspx generated
class
| derived from the codebehind class). that's why they can use different
| language to program while it is not allowed in the 2.0 model.
|
| In fact, the 2.0's partial class model has bring much more good features
| than the old one, for example, we don't need to explicitly declare member
| field for control instances in codebeind file....
|
| Here are the msdn reference which demonstrate the page compilation model
| change from beta1 to beta2:
|
| #Changes for Beta 2
| http://msdn.microsoft.com/asp.net/be...ta2update.aspx
|
| You can also find some other article on asp.net 2.0 's beta feature
| change/postpone or beta2 to RTM changes.
|
| Hope helps. Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
|
|
|
|
|
| --------------------
| | From: rj***@elegancetech.com
| | Newsgroups: microsoft.public.dotnet.framework.aspnet
| | Subject: Language in Page directive in VS 2005
| | Date: 29 Sep 2005 13:07:26 -0700
| | Organization: http://groups.google.com
| | Lines: 29
| | Message-ID: <11**********************@f14g2000cwb.googlegroups .com>
| | NNTP-Posting-Host: 68.81.183.207
| | Mime-Version: 1.0
| | Content-Type: text/plain; charset="iso-8859-1"
| | X-Trace: posting.google.com 1128024452 10674 127.0.0.1 (29 Sep 2005
| 20:07:32 GMT)
| | X-Complaints-To: gr**********@google.com
| | NNTP-Posting-Date: Thu, 29 Sep 2005 20:07:32 +0000 (UTC)
| | User-Agent: G2/0.2
| | X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;
SV1;
| .NET CLR 1.0.3705; .NET CLR 1.1.4322; Alexa Toolbar; .NET CLR
| 2.0.50215),gzip(gfe),gzip(gfe)
| | Complaints-To: gr**********@google.com
| | Injection-Info: f14g2000cwb.googlegroups.com;
posting-host=68.81.183.207;
| | posting-account=egBesgwAAADr2AGpmzETviTrt74lbz3H
| | Path:
|
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfee d00.sul.t-online.de!t-onli
|
ne.de!border2.nntp.dca.giganews.com!nntp.giganews. com!postnews.google.com!f1
| 4g2000cwb.googlegroups.com!not-for-mail
| | Xref: TK2MSFTNGXA01.phx.gbl
| microsoft.public.dotnet.framework.aspnet:128088
| | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| |
| | I'm using VS 2005 Beta 2.
| |
| | In VS 2003, the Page directive in an aspx page has Language and
| | CodeBehind attributes. You can have the language be different than the
| | code behind file language. For instance, you can have
| |
| | Language="vb"
| | CodeBehind="classA.cs"
| |
| | In VS 2005, the CodeBehind attribute seems to have been replaced with
| | the CodeFile attribute, although this is not documented in the beta
| | documentation. Therefore, it becomes
| |
| | Language="vb"
| | CodeFile="classA.cs"
| |
| | This causes a compile error:
| |
| | "The language of the code file is inconsistent with the language of the
| | page."
| |
| | According to the documentation for both VS 2003 and VS 2005, the
| | Language directive is supposed to be the language embedded in the aspx
| | page. Therefore, I should be able to have a Language that is different
| | from the CodeFile page in VS 2005.
| |
| | Why do I get this error? Is there a way to have a language for the page
| | be different from the code file language?
| |
| |
|
|

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Poppy | last post by:
I opened an asp page in VS.net 2002 and then saved it as an aspx page, "mypage.aspx". I was prompted if I wanted to create the class file for the page and clicked yes. Now when I try and open...
0
by: psb | last post by:
about a year ago, I was head deep in vb6/com+ hell. THEN, I started doing asp.net development and went the opposite direction by only putting transactions in the stored procs. Unfortunately, I...
2
by: Tim Zych | last post by:
I'm trying to stop .Net from validating data entered into a textbox. When I enter < or > .Net returns an error: potentially dangerous Request.Form value was detected from the client... so a...
1
by: Horace | last post by:
Hello Does anyone know how to remove (or make more general) both the Imports clause (in a class .vb file) and the Page directive (specifically the Inherits clause in a web page .aspx file). ...
3
by: David Lozzi | last post by:
Error: Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive at line 6 Line 4: <script RUNAT="SERVER"> Line 5: ...
1
by: Carlos | last post by:
Hi, I am now in the process of integrating different sources of asp .net pages. some of them include page directives with C#, and some with VB. The problem is that at compilation time there...
2
by: Martin Rosén-Lidholm | last post by:
In ASP.NET 2.0 (using VS.NET 2005 beta 1), you can define an available base class in the web.config file. I can also define the available base class for a class by using the Inherits attribute...
5
by: homertbush | last post by:
When our asp.net pages are rendered out as html the page directive is still in the html. ie. The following page directive is present in the body of the html of the rendered page: <%@ Page...
4
by: senfo | last post by:
This is probably a really stupid question, but what exactly is the <%@ Page %directive? I thought I knew the answer to this, but now I'm not so sure that I do. Essentially, what I'd hope to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.