我们还应该使用服务器端网格还是 Javascript 网格吗?

发布于 2024-11-26 22:32:44 字数 219 浏览 0 评论 0原文

我们在工作中就如何处理网格中的数据进行了大讨论。

有些人更喜欢使用服务器端网格,它可以轻松地从服务器绑定并使用 Ajax/或不更新。有些人更喜欢只使用调用 WebService 的 Javascript 来填充 Javascript/html 网格。

从专业角度来看,哪一个在生产力、可测试性和可维护性方面最好?

我们使用 WebForm .Net 4.0 和 Jquery。

We have a big discussion at work concerning how to handle data in grid.

Some people prefer to use Server Side grid which can be bind easily from the server and be updated with Ajax/or Not. And some people prefer to use only Javascript that call WebService to populate a Javascript/html grid.

From a professional perspective, which one is the best for productivity, testability and maintenability?

We are using WebForm .Net 4.0 and Jquery.

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

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

发布评论

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

评论(4

朦胧时间 2024-12-03 22:32:44

我肯定会说 JavaScript 控件。
我只是认为,在这些事情上,微软、Telerik 和所有其他人已经证明自己远远不如开源社区(主要是基于 jQuery 的解决方案)。

AJAX 和异步请求已经存在多年,但直到最近 Microsoft 才推出 MVC 来正确支持它(据我所知,它们仍然没有达到应有的水平)。

另一个优点是客户端的控件种类比服务器端的控件种类多得多,因此您可以找到完全适合您的控件。如果您需要它来做一些不是开箱即用的事情,它是开源的 - 您可以自己实现它。
我正在使用 jqgrid,我对此非常满意。

I would definitely say JavaScript controls.
I just think that in these things, Microsoft, Telerik and all the other guys have shown themselves to be far inferior to the open-source community (mostly jQuery-based solutions).

AJAX and asynchronous requests have been around for years, yet only recently did Microsoft come out with MVC to support it properly (and from what I'm hearing- they're still not as good as they should be).

another advantage is a far larger variety of controls for client-side than for server side, so you can find one that suits you exactly. and if you need it to do something that doesn't come out-of-the-box, it's open source- you can just implement it yourself.
I'm using jqgrid, and I'm quite happy with it.

三生一梦 2024-12-03 22:32:44

我和你的情况一样。最后,我选择了服务器端 GridView,因为将数据绑定到它非常容易。另一方面,每次刷新页面来更新 GridView 都很烦人,所以我最终使用 AJAX 更新面板的异步回发来保持一切顺利。

I was in the same scenario as you. In the end, I went with a server-side GridView because it was very easy to bind data to it. On the other hand, refreshing the page every time to update the GridView got annoying, so I ultimately used asynchronous post-backs with AJAX update-panels to keep everything smooth.

别把无礼当个性 2024-12-03 22:32:44

无论如何,Ajax 将是答案,因为没有人喜欢老式的回发和整页重新加载...ASP.NET MVC 提供了很多帮助,因为甚至没有回发和 Web 表单页面生命周期的旧概念。

我们确实也处于同样的情况,并且仍在考虑是否使用 DevExpress MVCGridView 扩展或 Telerik 扩展,或者像 ExtJs 这样的完整 JavaScript 解决方案,它很酷且快速,但似乎不支持单元格合并,这对我们来说是一项重要功能。

Ajax would be the answer anyway because nobody likes old fashion post backs and full page reloads... ASP.NET MVC helps a lot since there is not even the old concept of post back and web form page life cycle.

we do are also in the same situation and are still thinking if we use DevExpress MVCGridView extensions or Telerik one, or a full javascript solution like ExtJs which is cool and fast but does not seem to support cell merging which is an important feature for us.

一袭白衣梦中忆 2024-12-03 22:32:44

我们以前也有过这样的争论。

asp 网格的伟大之处在于它们基本上可以直接使用排序、分页等功能。而且您不必处理我个人讨厌的 javascript。但它们更多的是一种蛮力解决方案。我的意思是,回发、从数据库获取数据、重新绑定、重建页面,然后将其发送回来只是为了对列进行排序,效率极低。

即使在网格周围有一个 UpdatePanel,也可能有大量数据通过网络传输,并且有大量数据访问只是为了对表进行排序或分页。

Javascript 更丑陋,但效率更高。其一,排序(可能还有分页)可以在客户端非常快速地完全处理,从而减少服务器负载。但是除非您想使用第三方 JS 表组件,否则您必须为此编写自定义功能。

另一种选择是使用 ASP 网格,但使用 javascript 动态修改功能。这样您的服务器端代码仍然可以利用简单的绑定和表生成。

我们决定按原样使用 ASP 网格。如果我们以后遇到性能问题,我们将改变我们的方法。但是,要以最少的头痛快速完成某件事,您无法击败内置控件

We've had this argument before.

The great thing about asp grids is that they basically just work out of the box with sorting, paging, etc. And you don't have to deal with javascript, which I personally hate. But they are more of a brute force solution. I mean its horribly inefficient to post back, get data from a DB, rebind, rebuild a page, and send it back just to sort a column.

Even with an UpdatePanel around the grid, there is potentially a lot of data going over the wire and a lot of data access just to sort or page a table.

Javascript is uglier, but much more efficient. For one, sorting (and possibly paging) can be handled completely on the client very quickly, which reduces server load. But then you'll have to write custom functionality for this unless you want to use a third party JS table component.

Another option is the use the ASP grids, but modify the functionality with javascript on the fly. That way your server side code can still take advantage of the simple binding and table generation.

We decided to use the ASP grids as they are. If we run into performance issues down the road, we'll change our approach. But for getting something done quickly with a minimal headache, you can't beat the built in controls

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