ASP.Net控制VS HTML控制性能 [英] ASP.Net Control vs HTML Control Performance

查看:134
本文介绍了ASP.Net控制VS HTML控制性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我听说,我们应该避免默认ASP.Net控制,因为他们是沉重关于视图状态等..

I have heard that we should avoid Default ASP.Net Controls, because they are heavy regarding Viewstate and etc...

于是我就thinkink使用,每当我想只显示信息,并使用eval函数插入A HREF或SRC属性附加伤害服务器端代码的HTML标记。

So I was thinkink in using , , HTML tags whenever I want to only show information, and use the Eval function to insert server-side code in a href or src atribute.

但我也听说eval函数是不是最好的性能解决方案,因为它使用反射来评估论证通过。

But I have also heard that the Eval function is not the best performance solution, because it uses reflection to evaluate argument passed.

所以我用简单的HTML标签中明确的转换正计划。

So I was planning in using explicit cast inside simple html tags.

这是关于性能的最佳解决方案?你有没有其他sugestion /意见?

Is this the best solution regarding performance? Do you have any other sugestion/opinion?

推荐答案

而不是避免ASP.Net服务器控件,也许你可以把它这个办法:不要使用比你更需要

Rather than avoiding ASP.Net server controls, perhaps you could think of it this way: don't use more than you need.

如果您可以使用HTML标签,使用它。一个常用过度使用ASP.Net控制的标签。你只需要,如果你需要从你的样式表的格式不同的格式它使用的标签。如果你只是把HTML文本,你并不需要担心的ViewState。同样的,很多人用ASP.Net超链接时他们所真正需要的是一个<一个方式>

If you can use an HTML tag, use it. One commonly overused ASP.Net control is the Label. You only need to use the Label if you need to format it differently from your stylesheet formatting. If you just put the text in HTML, you don't need to worry about ViewState. Similarly, many people use the ASP.Net HyperLink when all they really need is an <a> .

它变得有点复杂与更复杂的控制。所有不同的网格,例如。这些可以是体积大,但它们是非常快写。我们有些人谁是大企业工作的,高性能的应用程序可能会写自己的HTML(从代码)来创建一个网格。

It gets a bit more complicated with the more complex controls. All the different grids, for example. Those can be bulky, but they are very quick to write. Some of us who are working on large, enterprise, high-performance apps might write our own HTML (from code) to create a grid.

除非表现是在你的web应用程序的一大因素,那么,我建议你开始明智地使用ASP.Net控制,简单的元素取代HTML。然后,当你变得更加熟悉这两种类型的控件,你什么时要使用将变得更明智的判断。

Unless performance is a big factor in your web app, then, I would suggest that you start out judiciously using the ASP.Net controls, substituting HTML for simple elements. Then, as you become more familiar with both kinds of controls, your judgment about what to use when will become better informed.

这篇关于ASP.Net控制VS HTML控制性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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