Asp.net - 从服务器创建 html 与使用 json

发布于 2024-12-05 11:12:30 字数 421 浏览 3 评论 0原文

我的问题是关于网页的性能。我需要创建一个树视图来显示大数据(10,000)节点。 asp.net reeeview 呈现自身的方式对性能不利,因为它使用 Table 标记。我创建了一个自定义控件来使用 div 和 span 制作树视图。我可以通过两种方法来做到这一点:

  1. 创建一个自定义控件,我将在其中覆盖渲染并放置我自己的 html,该控件将出现在页面上。当连接速度较慢时,这会对性能产生影响。但其他我认为性能会很好,因为浏览器只会渲染它。无需运行 JS。

  2. 创建一个 json 对象并将其渲染在页面上(在这种情况下,页面大小将小于上面的页面)。但是 IE6-8 不支持 javascript 硬件加速器,因此需要时间来运行 js 来生成对象。

所以我的问题是哪一个更好?我的用户的速度为 3 mbps,因此速度并不重要。

My question is regardign performance of the web page. I need to create a treeview which will display large data (10,000) nodes. The way asp.net reeeview renders itself it not good for performance as it uses Table tag. I created a custom control to make a treeview using div and spans. I can do that by 2 methods:

  1. Create a custom control where i will override the render and put my own html which will get on the page. This will have performance impact when connection speed is slow. But other i guess the performance will be godd as the browser will just render it. No JS to run.

  2. Create a json object and render it on page (in which case, page size would be lesser then the above page). But IE6-8 do not support javascript hardware accelerator and thus would take time to run the js to make the object.

So my question is which one would be better?? My users have 3 mbps speed and thus speed does not matter as such.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

牛↙奶布丁 2024-12-12 11:12:30

好吧,除非用户是雨人,否则他不太可能一眼就分析 10000 个节点,所以为什么不让这些节点按需加载(如果树很深 - 在节点扩展时加载,如果树是很长 - 滚动或加载)?
Telerik 演示示例: http://demos.telerik.com/aspnet-mvc/treeview/ajaxloading

Well, unless user is rainman, it is very unlikely, that he will analyze 10000 nodes at a glance, so why not to make those nodes load on demand (in case tree is very deep - load when node is expanded, in case tree is very long - load on scroll or smth)?
Telerik demo sample: http://demos.telerik.com/aspnet-mvc/treeview/ajaxloading

把人绕傻吧 2024-12-12 11:12:30

这不仅仅是带宽的问题。但这样的大小会影响客户端的内存泄漏。
我将创建一个单独的 Web 方法,该方法返回 JSON 并使用一些 javascript 组件(例如 ExtJs)构建树

It's not only matter of bandwidth . But such size can affect to memory leak in client.
I would create a separate Web Method that returns JSON and will build Tree using some javascript component such as ExtJs

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文