简体   繁体   English

使用AJAX从CSV文件检索和显示数据

[英]Retrieving & Displaying data from csv files using AJAX

I need to provide a feature such that the user is able to upload a csv file.Once the uploading is done I need to retrieve each value and show it on a grid which is implemented using far point( http://www.fpoint.com/products/spread/spread.aspx ).But all this has to be done without the page being refreshed.I use asp.net 2.0 & Ajax Pro.Remember I cannot use the inbuilt AJAX feature provided by microsoft . 我需要提供一个功能,使用户能够上传一个csv文件。上传完成后,我需要检索每个值并将其显示在使用farpointhttp://www.fpoint。 com / products / spread / spread.aspx )。但是所有这些都必须在不刷新页面的情况下完成。我使用asp.net 2.0和Ajax Pro。请记住,我不能使用Microsoft提供的内置AJAX功能。 To be precise I need something similar to the lines of attaching a file using gmail. 准确地说,我需要类似于使用gmail附加文件的内容。

First, you can't do an upload with AJAX - the technology doesn't support posting files. 首先,您无法使用AJAX上传-该技术不支持发布文件。 SO What I did in similar case (and what sites like gmail do) - put an upload control in an iframe within the page. 因此,我在类似情况下的操作(以及类似gmail的网站在做什么)-将上传控件放在页面内的iframe中。 When upload is complete the page in in the frame should trigger some event on the hosting page and the hosting page would do AJAX call to server to retrieve CSV values. 上传完成后,框架中的页面应在托管页面上触发某些事件,并且托管页面将对服务器执行AJAX调用以检索CSV值。 If you don't want to use MS AJAX, you can use AJAX capabilities of jQuery. 如果您不想使用MS AJAX,则可以使用jQuery的AJAX功能。 Here's a good example I used to learn ajax in jQuery: 这是我过去在jQuery中学习Ajax的一个好例子:

http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/ http://encosia.com/2008/05/29/using-jquery-to-direct-call-aspnet-ajax-page-methods/

Hope it helped, Andrey 希望能有所帮助,安德烈

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

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