为什么ASP.NET仍然需要runat =" server"到处? [英] Why does ASP.NET still require runat="server" everywhere?

查看:69
本文介绍了为什么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).


第一个非常明确的解决方案。这是一个有趣的线程,你可能会发现人们有用。很老的线索,但讨论很好。

http://forums.asp.net /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.
http://forums.asp.net/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"到处?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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