如何上传文件而不提交表格 [英] how to upload file without submitting the form
本文介绍了如何上传文件而不提交表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用asp.net我想检索excel文件中的数据而不按任何按钮从excel文件中检索数据的代码是在c#中所以我该怎么做一旦从客户端上传文件,就从客户端调用我的服务器端方法
可以告诉我如何实现它。
Hi,
I am using asp.net i want to retrieve the data within the excel file without pressing any button the code which retrieves the data from the excel file is in c# so how do i call my server side method from client side as soon as the file is being uploaded from the client side
can any one tell me how do i achieve it .
推荐答案
为此你必须使用jQuery ajax功能。它就像下面的(获取方法)。你可以检索或发布数据到服务器而不回发整个页面。
For that you have to use jQuery ajax functionality.It's like below(get method).You can retrieve or post data into server without post back the whole page.
( a#runSample1)。click(function(){
("a#runSample1").click(function() {
.get( GetServerTime.aspx,function(response){
alert(response);
});
});
.get("GetServerTime.aspx", function(response) { alert(response); }); });
欲了解更多信息,请查看:
在ASP.NET中使用jQuery for AJAX
在ASP.NET中使用jQuery for AJAX [ ^ ]
我希望这会对你有所帮助。
For more info check this :
Using jQuery for AJAX in ASP.NET
Using jQuery for AJAX in ASP.NET[^]
I hope this will help to you.
这篇关于如何上传文件而不提交表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文