问题描述
我正在比较每个命名空间的两个基类,并且有点困惑。
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和System.Web.UI.WebControls有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!