SRC而不是CodeBehind [英] SRC instead of CodeBehind

查看:56
本文介绍了SRC而不是CodeBehind的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




使用VS.NET 2003,如果我使用SRC页面属性而不是CodeBehind,那么我是否仍然拥有智慧和一般的IDE支持那个?


谢谢,

阿里

Hi,

Using VS.NET 2003, If i use SRC page attribute instead of CodeBehind, do i
still have intelisence and generally IDE support for that?

Thanks,
Ali

推荐答案

嗨理查德,


感谢您使用Microsoft新闻组服务。关于你提到的问题,SRC是指SRC。属性和CodeBehind <%@ Page

...>的属性Direction将为ASP.NET web指定不同的编译模式

页面。此外,在设计时设计

页面的绑定类时,这将产生完全不同的效果。以下是MSDN中的描述:


" CodeBehind" attribute:

指定包含与页面关联的类的编译文件的名称

。此属性由Visual Studio .NET Web窗体

设计器使用。它告诉设计者在哪里找到页面类,以便

设计师可以创建它的一个实例,供你在设计时使用。

例如,如果你在Visual Studio中创建一个名为

WebForm1的Web窗体页面,设计器将为CodeBhind属性分配值为

WebForm1.aspx.vb,用于Visual Basic或WebForm1。 aspx.cs,用于C#。这个

属性在运行时不使用。


" SRC" attribute:

指定代码隐藏类的源文件名,以便在请求页面时动态地编译
。您可以选择在代码隐藏类或代码声明中为您的页面添加编程

逻辑
.aspx文件中的
块。


注意RAD设计器(如Visual Studio .NET)不使用此

属性。相反,他们预先编译代码隐藏类,然后使用

Inherits属性。


因此,如果使用SRC,属性,IDE Designer在运行时请求页面之前不会获得页面的任何
绑定类信息。因此,当

设计页面类源时,它将失去智能和

一般IDE支持它。

Steven Cheng
Microsoft在线支持


安全! www.microsoft.com/security

(此帖子按原样提供,不作任何保证,并且不授予

权利。)

Hi Richard,

Thank you for using Microsoft Newsgroup Service. As for the question you
mentioned, the "SRC" attribute and "CodeBehind" attribute of the <%@Page
...> Direction will specify different compile mode for the ASP.NET web
page. Also, that will cause quite different effect when designing the
page''s binded class at design-time. Here is the description in the MSDN:

"CodeBehind" attribute:
Specifies the name of the compiled file that contains the class associated
with the page. This attribute is used by the Visual Studio .NET Web Forms
designer. It tells the designer where to find the page class so that the
designer can create an instance of it for you to work with at design time.
For example, if you create a Web Forms page in Visual Studio called
WebForm1, the designer will assign the Codebehind attribute the value of
WebForm1.aspx.vb, for Visual Basic, or WebForm1.aspx.cs, for C#. This
attribute is not used at run time.

"SRC" attribute:
Specifies the source file name of the code-behind class to dynamically
compile when the page is requested. You can choose to include programming
logic for your page either in a code-behind class or in a code declaration
block in the .aspx file.

Note RAD designers, such as Visual Studio .NET, do not use this
attribute. Instead, they precompile code-behind classes and then use the
Inherits attribute.

So if use "SRC" attribute, the IDE Designer won''t get any of the page''s
binded class info until the page is requested at runtime. Thus, when
designing the page class source, it will lose the intelisence and
generally IDE support for it.
Steven Cheng
Microsoft Online Support

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




感谢Steven的帮助。


我不知道并且IDE支持的最佳方式是使用代码。


我们喜欢使用SRC,因为我们可以使用记事本随时随地更改代码

,ASP.NET将负责编译;然而

我们也希望在实际开发过程中获得IDE支持。


要实现我们需要的东西,我可以用CodeBehind页面开发我的Web应用程序

部署将所有CodeBehind页面属性更改为SRC?


重新开始我的问题:如果我使用CodeBehind

页面属性开发我的Web应用程序,我可以更改CodeBehinf吗?到SRC和我的页面由ASP.NET编译

?如果答案是否定的,那么我该如何转换页面来自

" CodeBehind"模型到SRC模特?


再次感谢,

阿里



" MSFT" <,V - ****** @ online.microsoft.com>在消息中写道

news:dS ************** @ cpmsftngxa07.phx.gbl ...

Thanks Steven for help.

I underestand the best way to have IDE support is using code behind.

We like to use SRC because we can use notepad to change the codes
whenever/wherever we want and ASP.NET will take care of compilation; however
we also would like to have IDE support during the actual development.

To achive what we need can i develop my web application with CodeBehind page
attribute (to have IDE support during development) and right before
deployment change all CodeBehind page attribute to SRC ?

To re-phrase my question: If i develop my web application using CodeBehind
page attribute, can i change "CodeBehinf" to "SRC" and my pages get compiled
by ASP.NET? If the answer is no, then how can I convert a page from
"CodeBehind" model to "SRC" model ?

Thanks again,
Ali


"MSFT" <v-******@online.microsoft.com> wrote in message
news:dS**************@cpmsftngxa07.phx.gbl...
嗨理查德,

感谢您使用Microsoft新闻组服务。至于你提到的问题,SRC是指SRC。属性和CodeBehind <%@ Page
..>的属性Direction将为ASP.NET web页面指定不同的编译模式。此外,在设计时设计
页面的绑定类会产生完全不同的效果。以下是MSDN中的描述:

CodeBehind attribute:
指定包含与页面关联的类的已编译文件的名称。 Visual Studio .NET Web Forms
设计器使用此属性。它告诉设计者在哪里找到页面类,以便
设计者可以在设计时创建它的实例。
例如,如果在Visual Studio中创建Web窗体页面称为WebForm1,设计人员将为CodeBhind属性赋值为WebForm1.aspx.vb,对于Visual Basic或WebForm1.aspx.cs,为C#。此
属性不会在运行时使用。

SRC attribute:
指定代码隐藏类的源文件名,以便在请求页面时动态地编译。您可以选择在代码隐藏类或.aspx文件中的代码声明块中包含页面的编程逻辑。

注意RAD设计师,例如作为Visual Studio .NET,不要使用此
属性。相反,它们预编译代码隐藏类,然后使用
Inherits属性。

因此,如果使用SRC,属性,IDE Designer在运行时请求页面之前不会获得任何页面的绑定类信息。因此,当设计页面类源时,它将失去智能和一般IDE支持它。

Steven Cheng
Microsoft在线支持

获得安全! www.microsoft.com/security
(此帖已提供按原样,没有任何保证,也没有赋予
权利。)
Hi Richard,

Thank you for using Microsoft Newsgroup Service. As for the question you
mentioned, the "SRC" attribute and "CodeBehind" attribute of the <%@Page
..> Direction will specify different compile mode for the ASP.NET web
page. Also, that will cause quite different effect when designing the
page''s binded class at design-time. Here is the description in the MSDN:

"CodeBehind" attribute:
Specifies the name of the compiled file that contains the class associated
with the page. This attribute is used by the Visual Studio .NET Web Forms
designer. It tells the designer where to find the page class so that the
designer can create an instance of it for you to work with at design time.
For example, if you create a Web Forms page in Visual Studio called
WebForm1, the designer will assign the Codebehind attribute the value of
WebForm1.aspx.vb, for Visual Basic, or WebForm1.aspx.cs, for C#. This
attribute is not used at run time.

"SRC" attribute:
Specifies the source file name of the code-behind class to dynamically
compile when the page is requested. You can choose to include programming
logic for your page either in a code-behind class or in a code declaration
block in the .aspx file.

Note RAD designers, such as Visual Studio .NET, do not use this
attribute. Instead, they precompile code-behind classes and then use the
Inherits attribute.

So if use "SRC" attribute, the IDE Designer won''t get any of the page''s
binded class info until the page is requested at runtime. Thus, when
designing the page class source, it will lose the intelisence and
generally IDE support for it.
Steven Cheng
Microsoft Online Support

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



您不想改变CodeBehind。到Src - 你想同时使用。

" CodeBehind"告诉VS.Net IDE在

设计时找到CodeBehind文件。 " Src的"告诉你的ASP.Net页面模板在哪里可以找到它

运行时间。


-

HTH,

Kevin Spencer

..Net开发人员

微软MVP

大项目组成

很多小东西。


" A.M" < IH ******* @ sapm123.com>在留言中写道

新闻:O2 ************** @ TK2MSFTNGP09.phx.gbl ...
You don''t want to CHANGE "CodeBehind" to "Src" - you want to use BOTH.
"CodeBehind" tells the VS.Net IDE where to find the CodeBehind file at
design-time. "Src" tells your ASP.Net Page Template where to find it at
run-time.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"A.M" <IH*******@sapm123.com> wrote in message
news:O2**************@TK2MSFTNGP09.phx.gbl...

谢谢史蒂文寻求帮助。

我感到不安,IDE支持的最佳方式是使用代码。

我们喜欢使用SRC,因为我们可以使用记事本来更改代码
无论何时何地,只要我们想要,ASP.NET就会负责编译;
但是我们也希望在实际开发过程中获得IDE支持。

要实现我们需要的东西,我可以使用CodeBehind
页面属性开发我的Web应用程序(以获得IDE支持)在开发期间)并且在部署之前将所有CodeBehind页面属性更改为SRC?

要重新表达我的问题:如果我使用CodeBehind
页面属性开发我的Web应用程序,可以我改变了CodeBehinf到SRC我的页面得到ASP.NET编译的
?如果答案是否定的,那么我如何从
CodeBehind转换页面呢?模型到SRC模特?

再次感谢,


" MSFT" <,V - ****** @ online.microsoft.com>在消息中写道
新闻:dS ************** @ cpmsftngxa07.phx.gbl ...

Thanks Steven for help.

I underestand the best way to have IDE support is using code behind.

We like to use SRC because we can use notepad to change the codes
whenever/wherever we want and ASP.NET will take care of compilation; however we also would like to have IDE support during the actual development.

To achive what we need can i develop my web application with CodeBehind page attribute (to have IDE support during development) and right before
deployment change all CodeBehind page attribute to SRC ?

To re-phrase my question: If i develop my web application using CodeBehind
page attribute, can i change "CodeBehinf" to "SRC" and my pages get compiled by ASP.NET? If the answer is no, then how can I convert a page from
"CodeBehind" model to "SRC" model ?

Thanks again,
Ali


"MSFT" <v-******@online.microsoft.com> wrote in message
news:dS**************@cpmsftngxa07.phx.gbl...
嗨理查德,

感谢您使用Microsoft新闻组服务。至于你提到的问题,SRC是指SRC。属性和CodeBehind <%@ Page
..>的属性Direction将为ASP.NET web页面指定不同的编译模式。此外,在设计时设计
页面的绑定类会产生完全不同的效果。以下是MSDN中的描述:

CodeBehind attribute:
指定包含与页面关联的类
的已编译文件的名称。 Visual Studio .NET Web
表单设计器使用此属性。它告诉设计者在哪里找到页面类,以便
设计者可以创建它的实例,供您在设计
时使用。例如,如果在Visual Studio中创建一个名为
WebForm1的Web窗体页面,设计器将为CodeBhind属性分配值为WebForm1.aspx.vb的值,用于Visual Basic或WebForm1.aspx.cs ,对于C#。此
属性不会在运行时使用。

SRC attribute:
指定代码隐藏类的源文件名,以便在请求页面时动态地编译。您可以选择在代码隐藏类或.aspx文件中的代码
声明块中包含
编程逻辑。

注意RAD设计师,例如作为Visual Studio .NET,不要使用此
属性。相反,它们预编译代码隐藏类,然后使用
Inherits属性。

因此,如果使用SRC,属性,IDE Designer在运行时请求页面之前不会获得任何页面的绑定类信息。因此,当设计页面类源时,它将失去智能和一般IDE支持它。

Steven Cheng
Microsoft在线支持

获得安全! www.microsoft.com/security
(此帖已提供按原样,没有任何保证,也没有赋予
权利。)
Hi Richard,

Thank you for using Microsoft Newsgroup Service. As for the question you
mentioned, the "SRC" attribute and "CodeBehind" attribute of the <%@Page
..> Direction will specify different compile mode for the ASP.NET web
page. Also, that will cause quite different effect when designing the
page''s binded class at design-time. Here is the description in the MSDN:

"CodeBehind" attribute:
Specifies the name of the compiled file that contains the class associated with the page. This attribute is used by the Visual Studio .NET Web Forms designer. It tells the designer where to find the page class so that the
designer can create an instance of it for you to work with at design time. For example, if you create a Web Forms page in Visual Studio called
WebForm1, the designer will assign the Codebehind attribute the value of
WebForm1.aspx.vb, for Visual Basic, or WebForm1.aspx.cs, for C#. This
attribute is not used at run time.

"SRC" attribute:
Specifies the source file name of the code-behind class to dynamically
compile when the page is requested. You can choose to include programming logic for your page either in a code-behind class or in a code declaration block in the .aspx file.

Note RAD designers, such as Visual Studio .NET, do not use this
attribute. Instead, they precompile code-behind classes and then use the
Inherits attribute.

So if use "SRC" attribute, the IDE Designer won''t get any of the page''s
binded class info until the page is requested at runtime. Thus, when
designing the page class source, it will lose the intelisence and
generally IDE support for it.
Steven Cheng
Microsoft Online Support

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




这篇关于SRC而不是CodeBehind的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆