简体   繁体   English

微软AJAX更新面板的替代品?

[英]A pro alternative to microsoft AJAX Update panel?

as you all know update panel send the same response to server as a full post back ( or maybe i am understanding wrong), it is true that it is much better than a full post back. 众所周知,更新面板向服务器发送相同的响应作为完整的帖子回来(或者我理解错误),它确实比完整的帖子更好。

so is there an alternative to send only response data ? 那么有没有只发送响应数据的替代方案? like you have a method that ill return date, i think this is the only thing that should be sent and not the whole control view state that is going to show it ( again maybe i understood it wrong). 就像你有一个方法,错误的返回日期,我认为这是唯一应该发送的东西,而不是将要显示它的整个控制视图状态(再次,也许我明白错了)。

i am using Telerik AJAX controls, and they are built upon Microsoft AJAX so there is not much of improvement there. 我正在使用Telerik AJAX控件,它们是基于Microsoft AJAX构建的,因此没有太大的改进。

one approach i like is http://www.coolite.com/ they have AJAX Methods and events, which i think is what i am looking for, but the project is moving slowly and does not have flexibilities for my requirements. 我喜欢的一种方法是http://www.coolite.com/他们有AJAX方法和事件,我认为这是我正在寻找的,但项目进展缓慢,并没有我的要求的灵活性。

so any input is highly appreciated. 所以任何输入都受到高度赞赏。

If you want more control, one technique is to use JQuery and AJAX Client Library for ADO.NET Data Services to bind JSON data on the client side. 如果您想要更多控制,一种技术是使用JQuery和AJAX Client Library for ADO.NET Data Services来绑定客户端的JSON数据。

Check this sample here . 在这里查看此示例。 This is a good example of JQuery complementing ASP.Net AJAX. 这是JQuery补充ASP.Net AJAX的一个很好的例子。

First, I'm retrieving data from SQL Server and I need it in JSON format. 首先,我正在从SQL Server检索数据,我需要它以JSON格式。 I'm using the AJAX Client Library for ADO.NET Data Services to make a REST (GET) query to the back-end. 我正在使用ADAX.NET数据服务的AJAX客户端库对后端进行REST(GET)查询。 To start with I'll just get the data...I include "datatable.js" as a client-side script and use Sys.Data.DataService() to make an async query. 首先,我将获取数据...我将“datatable.js”包含为客户端脚本,并使用Sys.Data.DataService()进行异步查询。 In JavaScript you can tell it's a Microsoft type if it's got "Sys." 在JavaScript中,如果它是“Sys”,你可以告诉它是Microsoft类型。 front of it. 它的前面。 All the client support for ADO.NET Data Services is in datatable.js. ADO.NET数据服务的所有客户端支持都在datatable.js中。

This is why I encourage programmers new to AJAX to learn the basics before adopting a library - when you understand what's actually happening, this sort of optimization becomes obvious. 这就是为什么我鼓励新手AJAX的程序员在采用库之前学习基础知识 - 当你了解实际发生的事情时,这种优化就变得很明显了。

so is there an alternative to send only response data? 那么有没有只发送响应数据的替代方案? Like, you have a method that will return only a date? 比如,你有一个只返回日期的方法?

Yes. 是。 The most basic way is to just write the date string to the response stream and end the response before anything else is sent - HTTP Handlers (ashx) work great for this. 最基本的方法是将日期字符串写入响应流并在发送任何其他内容之前结束响应 - HTTP处理程序(ashx)对此非常有用。 For a more ASP.NET AJAX-friendly technique, check out Web Methods. 有关ASP.NET AJAX的更多技术,请查看Web方法。

Rather than investigate controls I would suggest you investigate Ajax as a technology, and find out how it works. 我建议您调查Ajax作为一种技术,而不是调查控件,并找出它是如何工作的。 Having done this then look at the available implementations eg UpdatePanels, JQuery, etc 完成后,查看可用的实现,例如UpdatePanels,JQuery等

as you all know update panel send the same response to server as a full post back ( or maybe i am understanding wrong) 众所周知,更新面板发送相同的响应服务器作为完整的帖子回来(或者我理解错误)

The main idea of the AJAX framework is to eliminate full-page postbacks. AJAX框架的主要思想是消除整页回发。 Only the relevant parts of the page are updated, without a disturbing refresh. 只更新页面的相关部分,而不会产生令人不安的刷新。 The markup that is transferred between the client machine and the server is reduced dramatically, which results in a significant performance improvement for the user. 在客户端计算机和服务器之间传输的标记显着减少,这为用户带来了显着的性能提升。

but if you looking for an alternative to page postback then I would recommend jQuery , but from the question it seems as if you're new to AJAX, so assuming you know javascript, hopefully you know that first to understand how jQuery works 但如果你寻找页面回发的替代方案,那么我会推荐jQuery ,但从问题看来,好像你是AJAX的新手,所以假设你知道javascript,希望你知道首先要了解jQuery是如何工作的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM