ASP的控制VS HTML控件 [英] asp control vs html control

查看:108
本文介绍了ASP的控制VS HTML控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

进出口新的网络编程,我已经开始与asp.net 2.0,我想知道什么是使用比ASP的控制HTML控件的差异,我想知道太多属性如何RUNAT =断绝的作品。

Im new to web programming and i've started with asp.net 2.0,i would like to know what are the differences on using an html control than an asp control,and i'd like to know too how the attribute runat = "sever" works.

推荐答案

这是asp.net控件和HTML控件之间的差异

These are the differences between the asp.net controls and html controls


  • HTML服务器控件:

HTML服务器控件:是HTML标记由服务器理解

HTML server controls :are HTML tags understood by the server

在ASP.NET文件中的HTML元素,在默认情况下,视为文本。为了使这些元素可编程,添加一个 =服务器属性的HTML元素。这属性表示元素应作为服务器控件进行处理。 id属性添加到标识服务器控制。 id引用可用于操作运行时服务器控件。

HTML elements in ASP.NET files are, by default, treated as text. To make these elements programmable, add a runat="server" attribute to the HTML element. This attribute indicates that the element should be treated as a server control. The id attribute is added to identify the server control. The id reference can be used to manipulate the server control at run time.

请注意:所有HTML服务器控件必须内<与form>标签
  =服务器属性。该=服务器属性指示
  表单应在服务器上进行处理。这也表明,
  封闭式控件可被服务器脚本访问。

Note: All HTML server controls must be within a < form > tag with the runat="server" attribute. The runat="server" attribute indicates that the form should be processed on the server. It also indicates that the enclosed controls can be accessed by server scripts.

例如:
&LT; INPUT TYPE =文本ID =ID1=服务器/&GT; 它将工作。
HtmlTextControl类

Ex: < input type="text" id="id1" runat="server" /> It will work. HtmlTextControl class

&LT;输入类型=按钮ID =ID2RUNAT =断绝/&GT; 这是行不通的。
对于HTML按钮控件有控制类的任何可兼容版本。

< input type="button" id="id2" runat="sever" /> It will not work. For html button control there is no compatiable version of control class.

纠正一个是

< input type="submit" id="id2" runat="server" />

htmlButton类

htmlButton class

&LT; INPUT TYPE =复位ID =ID2RUNAT =断绝/方式&gt; 这一次不是作品


  • ASP.NET - Web服务器控件

Web服务器控件是服务器可理解的特殊ASP.NET标签。

Web server controls are special ASP.NET tags understood by the server.

就像HTML服务器控件,也对创建的Web服务器控件
  服务器和他们需要runat =server属性的工作。然而,
  Web服务器控件不必映射到任何现有的HTML
  元素,它们可能会重新present更复杂的元素。

Like HTML server controls, Web server controls are also created on the server and they require a runat="server" attribute to work. However, Web server controls do not necessarily map to any existing HTML elements and they may represent more complex elements.

创建Web服务器控件的语法是:

The syntax for creating a Web server control is:

< asp:textbox id="Textbox1" runat="server" />

这也是区分大小写。在这里,重要的是必须写=服务器。对于HTML控件,这是可选的。

These also case insensitive. Here important thing is compulsory to write runat="server". For HTML controls this is optional.

所有HTML&LT; INPUT TYPE =文本/>控件的属性也可用于这些标签的ASP服务器控件也。一些特殊的属性也是他们的,我们将在阿贾克斯讨论的特殊属性。

all HTML < input type="text" /> control's attributes also available for these asp tagged server controls also. Some special attributes also their we will discuss on Ajax for special attributes.

这篇关于ASP的控制VS HTML控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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