asp.net:;服务器&QUOT RUNAT =&QUOT之间的差额;和服务器控件 [英] asp.net: difference between runat="server" and server controls

查看:149
本文介绍了asp.net:;服务器&QUOT RUNAT =&QUOT之间的差额;和服务器控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是什么

<asp:Button id="button1" Text="Click me" runat="server" OnClick="submitEvent" />

<input type="button" id="button1" runat="server" value="Click me" />

是否与=服务器属性,输入有其他的或有限的属性和方法?

Does the input with runat="server" attribute has other or limited properties and methods?

感谢您!

推荐答案

第一个创建了一个 System.Web.UI.WebControls.Button ,而第二个创建 System.Web.UI.HtmlControls.HtmlInputButton

The first one creates a System.Web.UI.WebControls.Button while the second one creates a System.Web.UI.HtmlControls.HtmlInputButton.

两者都是服务器控件,但在器WebControls 命名空间的控制一般具有比 HtmlControls 命名空间。通常情况下,他们把一些数据的ViewState 来保持自己的状态跟踪,他们有服务器端回发事件。

Both are server controls, but the controls in the WebControls namespace generally has a bit more functionality than the controls in the HtmlControls namespace. Typically they put some data in ViewState to keep track of their state, and they have server side postback events.

HtmlControls 命名空间的每个控制完全对应一个HTML元素,而在器WebControls 命名空间中的控件可能将取决于什么正在请求的页面,浏览器可以支持不同的渲染。

Each controls in the HtmlControls namespace correspond exactly to an HTML element, while the controls in the WebControls namespace may be rendered differently depending on what the browser that is requesting the page can support.

这篇关于asp.net:;服务器&QUOT RUNAT =&QUOT之间的差额;和服务器控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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