Click here to Skip to main content
15,918,275 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can i avoid the Page reload when i am upload any file in Asp.net using C#?
Posted
Comments
Prasad_Kulkarni 23-Apr-12 6:40am    
Have you used update panel control??
Post your code snippet, to get exact answer.
Sam Path 23-Apr-12 6:46am    
ya i am using Update panel but page is reloading..
[no name] 23-Apr-12 7:15am    
which .net version you are using?
Sam Path 23-Apr-12 7:20am    
Version 4.0
Sandeep Mewara 23-Apr-12 7:44am    
How come a page would auto-reload until you specify? Not clear.

I can give you some links which will give you idea about avoiding page refresh please go through it:
Prevent Page Refresh in C#[^]
Detecting Page Refresh[^]
How to prevent page refresh in asp.net[^]

This question was already ask'd on this forum; see if you get some help from it:
how to avoid page refreshing while uploading file[^]
 
Share this answer
 
v2
Comments
Sandeep Mewara 23-Apr-12 7:45am    
Not sure how you much the answer is relevant. Why would a page refresh handling be the solution when user has not even specified how/why page refreshed! One should look at the root cause of page refresh then to prevent page refresh here.
Prasad_Kulkarni 23-Apr-12 9:14am    
OP has stated in his question that he needs to avoid page refresh while he uploads any file. And answer is much relevant which do some needful for him surely.
Sandeep Mewara 23-Apr-12 9:37am    
:doh:! Can you reply me where exactly this page-refresh event came in picture? Who is triggering it? Why? No doubt answer is relevant if it is just to stop refresh.

[BTW, just shared my feedback! Relax, you already have 5 on your answer.]
Hi,
If I am not wrong then you are trying to upload a file from the page file upload only and after upload you don't want to reload the page. If yes, then try to put your contents like file upload controls and some other dynamic valued controls which should be updated after uploading the files inside "UPDATE PANEL".

For assistence visit these links:
http://www.asp.net/web-forms/tutorials/aspnet-ajax/understanding-asp-net-ajax-updatepanel-triggers[^]
http://ajax.net-tutorials.com/controls/updatepanel-control/[^]

If no then try posting comment with your problem in details..

All the best..
 
Share this answer
 
Alternatively you can use jquery with a C# handler to upload a file. It will not cause any post back..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900