[英]Is there a way to get to the HTML controls on an ASP.NET page?
I am wondering if ASP.NET stores a reference to the HTML controls on an ASP.NET page. 我想知道ASP.NET是否存储对ASP.NET页面上的HTML控件的引用。 Does it store something like a server-side Document Object Model (DOM) for the HTML controls?
它是否为HTML控件存储类似服务器端文档对象模型(DOM)的内容?
I believe qualifying my question with ASP.NET Web Forms or ASP.NET MVC would be irrelevant. 我相信使用ASP.NET Web Forms或ASP.NET MVC来验证我的问题是无关紧要的。 However, still, if you were to ask, I am more interested in knowing about Web Forms.
但是,如果您要问,我更感兴趣的是了解Web表单。 Does ASP.NET Web Forms store an object model for the HTML controls on the page?
ASP.NET Web窗体是否为页面上的HTML控件存储对象模型?
If you add "runat="server" to most normal html controls, you can reference them in code-behind. 如果你将“runat =”server“添加到大多数普通的html控件中,你可以在代码隐藏中引用它们。
These are in the System.Web.UI.HtmlControls library. 它们位于System.Web.UI.HtmlControls库中。
Example: an HtmlAnchor for the <a>
tag can be found in MSDN here with a code sample at the end. 示例:
<a>
标记的HtmlAnchor可以在MSDN中找到 ,最后带有代码示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.