为什么ASP.NET仍然需要runat =" server"到处?

编程入门 行业动态 更新时间:2024-10-24 14:17:31
本文介绍了为什么ASP.NET仍然需要runat =" server"到处?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

为什么以所有那些神圣的名义,ASP.NET仍然需要runat =server到处?我知道最初runat属性有多个选项,所以你可以使用runat =client或runat =myemergencybackupserverinshanghai或诸如此类的东西,但由于这些都没有实现,所以runat =server属性服务只是为了让那些错误遗漏的网站崩溃!那么,任何比我更了解ASP.NET的人,为什么这个神圣的构造仍然存在?

Why in the name of all that's holy does ASP.NET still require runat="server" all over the place? I understand that initially there were to be multiple options for the runat attribute, so you could have runat="client" or runat="myemergencybackupserverinshanghai" or whatnot, but since none of those were ever implemented, the runat="server" attribute serves only to crash sites that leave it out by mistake! So, anyone with more knowledge of ASP.NET than me, WHY is this godawful construct still there?

推荐答案

这里是 [ ^ ]几年后关于该主题的讨论。不确定它是否有用,但它很有趣。 :) Here's [^] a discussion from a couple of years back on that subject. Not sure if it's helpful or not, but it was interesting. :)

我的2美分:它如何知道它是客户端控件还是服务器端。例如您可以将此标记添加到HTML控件并在服务器代码中使用它。我同意在某种程度上,ASP.NET服务器控件可以自动执行此过程(即不依赖于用户添加此标记)。 My 2 cents : how would it know if its a clientside control or server side. e.g. you can add this tag to HTML controls and use it in server code. I would agree to some extent that ASP.NET server controls can automate this process (i.e. not relying on user to add this tag).

第一个非常明确的解决方案。这是一个有趣的线程,你可能会发现人们有用。很老的线索,但讨论很好。 forums.asp /p/767126/767612.aspx [ ^ ] 阅读此区域。 First solution of pretty clear. Here is one interesting thread which you people may find useful. Very old thread, but having good discussion. forums.asp/p/767126/767612.aspx[^] Read this area. Internet Explorer supports DHTML behaviors. 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

更多推荐

为什么ASP.NET仍然需要runat =" server"到处?

本文发布于:2023-06-08 03:55:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/576172.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:runat   NET   ASP   server   quot

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!