原因从控件删除ID在页面上 [英] Reasons to remove ID's from Controls in on pages

查看:112
本文介绍了原因从控件删除ID在页面上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能消除在.NET中被renedered从页面的ID。这可以通过简单的设置元素的ID标签用=服务器属性为空来完成。显然,这不应该为有被评估在回发的情况下使用控制/来完成。我如何去除广泛的ID会被人知道了这个使用可以做得非常​​好奇。我知道,通过删除ID值你能够节省一些带宽,但是应该开始使用这种方法的原因是什么?

It is possible to remove ID's from pages being renedered in .NET. This can be done by simply setting the ID tag of an element with the attribute runat="server" to null. Obviously this shouldn't be done for controls that have to be evaluated / used on postback scenarios. I am very curious on how widely removing ID's will be used by people knowing this can be done. I know that by removing ID values you are able to save some bandwith, but what should be a reason to start using this method?

推荐答案

如果你真的关心我的表现也许会少担心有关.NET控件ID的冗长(这是我的一个真正的宠物不喜欢)而更担心整体的回传模式。

If you're really concerned with performance I'd perhaps worry less about the verboseness of the .NET control IDs (which is a real pet dislike of mine) and worry more about the overall postback model.

整个发送状态到客户端,以便它可以将它张贴包到服务器是在这两个延迟和带宽方面完全不能胜任。

The whole send the state to the client so that it can post it pack to the server is woefully inefficient in both latency and bandwidth terms.

如果这是一个新项目,它可能是值得采用MVC模式,或者如果它存在尝试打开网页COM pression在IIS。

If it's a new project it's probably worth use MVC instead, or if it's existing try turning page compression on in IIS.

这篇关于原因从控件删除ID在页面上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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