System.Web.UI.HtmlControls和System.Web.UI.WebControls有什么区别 [英] What's the difference between System.Web.UI.HtmlControls and System.Web.UI.WebControls

查看:154
本文介绍了System.Web.UI.HtmlControls和System.Web.UI.WebControls有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在比较每个命名空间的两个基类,并且有点困惑。

I am comparing the two base classes of each namespace and am a bit confused.

System.Web.UI.WebControls.WebControl
System.Web.UI.HtmlControls.HtmlControl

二。例如, HtmlControl 具有较少的属性,而 WebControl 具有许多属性,例如CssClass属性。除了$code> WebControl 基类以外,它在处理渲染方面似乎更强大。

I see small difference between the two. For instance, HtmlControl has much fewer properties while WebControl has a lot of properties like the CssClass property. Other than just extra properties the WebControl base class seems to be more robust in the way it handles rendering.

为什么需要两个命名空间和两组几乎相同的控件?

Why the need to have two namespaces and two sets of almost Identical Controls?

推荐答案

System.Web.UI.HtmlControls中的控件只是实际HTML控件的一个薄包装。 System.Web.UI.WebControls.WebControl是您的标准ASP.NET控件。

The controls in System.Web.UI.HtmlControls are just a thin wrapper around actual HTML controls. System.Web.UI.WebControls.WebControl are your standard ASP.NET controls.

对此进行一些扩展:


System.Web.UI.HtmlControls
命名空间包含允许

a Web表单页面上创建HTML服务器控件的类。 HTML服务器控件
在服务器上运行,并直接映射到大多数
浏览器支持的
标准HTML标签。这使您可以
以编程方式控制Web表单页面上的HTML
元素。

The System.Web.UI.HtmlControls namespace contains classes that allow you to create HTML server controls on a Web Forms page. HTML server controls run on the server and map directly to standard HTML tags supported by most browsers. This allows you to programmatically control the HTML elements on a Web Forms page.

这篇关于System.Web.UI.HtmlControls和System.Web.UI.WebControls有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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