gpt4 book ai didi

asp.net - 为什么 ASP.Net 服务器控件声明需要 runat ="server"属性?

转载 作者:行者123 更新时间:2023-12-04 17:59:38 25 4
gpt4 key购买 nike

确定它们以“
当我不小心这样做时,编译器告诉我我错过了它,这总是让我感到烦恼。有点像“var”背后的想法——如果编译器知道它是什么......为什么还要期待我陈述呢?

最佳答案

取自 this forum thread :

Internet Explorer supports DHTML behaviors.

[The asp:control syntax] does not mean server control. You can create client DHTML component that has namespace and will run on the client machine. Also, namespaces are allowed in XHTML and techically you can use asp namespace for something else on a client, if you wish. Runat="server" prevents namespace clash. If element has no runat="server" attribute, it will be sent to the client browser unchanged. Therefore, you can use HTML components (HTCs) in ASP.NET pages as well.

Have a look here

http://msdn.microsoft.com/workshop/author/behaviors/howto/creating.asp http://msdn.microsoft.com/workshop/author/behaviors/overview.asp



Mike Schinkel 也 has a blog post探索为什么 runat=server 是必要的。

关于asp.net - 为什么 ASP.Net 服务器控件声明需要 runat ="server"属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1143757/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com