Click here to Skip to main content
13,004,188 members (69,719 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi Friends,
On a button click event, I am calling File save dialogue box.
After saving the file, I want to refresh the radgrid.
When I try with RadGrid.Rebind() method, it calls the NeedDatasource event of the grid with no problem.
I can see updated values in object. But I cannot see those updated values in grid.
I need to refresh the page.
So to refresh the page, I called " this.Page_Load(null, null); "
but no luck.
I have to hit F5 button to refresh the page.

If I remove the code to call Save File Dialogue box, it works perfectly.
There is something wrong with the response of the page.

Could you please help me out?

This is my code :
protected void btnPayment_Click(object sender, EventArgs e)
         // Perform some actions...
// This code below calls the Save File Dialogue box..
String FilePath = Server.MapPath(".\\GiroPayments\\" + FileName + "");
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ContentType = "text/plain";
response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ";");
this.Page_Load(null, null);
Posted 1-Jul-12 22:58pm
Sandeep Mewara 2-Jul-12 6:36am
You do a Response.End and thus the code after it is not getting executed.
LokeshZende 2-Jul-12 6:38am
yes sandip, thats the reason. Any solution for it?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1


follow the code

if (!Page.IsPostBack)
            //page will be refereshed at a interval of 10 sec
            Response.AddHeader("Refresh", "10");
LokeshZende 2-Jul-12 5:16am
It works only till FileSave Dialogue box opens.
Once I save the file, nothing happens.Page doesn't refresh.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

I would suggest to you to do the file download functionality in an iFrame / a popup so that you can work in the main page after downloading the file also, so when you do


It only ends the Response object of the iFrame/popup so that it doesn't ends the main Response Object

Mark it as solution if it answer your question
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

There is no way out for this situation.
Once response ends, we cannot get another response as there is only one response to one request.
So I added another button on the form, on click of which, it will refresh my page.
User HAS TO click the button in order to refresh the page.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170627.1 | Last Updated 3 Jul 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100