从服务器端参考页面 [英] Referesh page from server side

查看:149
本文介绍了从服务器端参考页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,
在按钮单击事件中,我正在调用文件保存"对话框.
保存文件后,我想刷新radgrid.
当我尝试使用RadGrid.Rebind()方法时,它会毫无问题地调用网格的NeedDatasource事件.
我可以在对象中看到更新的值.但是我无法在网格中看到这些更新的值.
我需要刷新页面.
因此,要刷新页面,我称" this.Page_Load(null,null); "
但没有运气.
我必须按F5键才能刷新页面.

如果删除代码以调用保存文件对话框"框,则它可以正常工作.
页面的响应有问题.

你能帮我吗?

这是我的代码:

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)
{
  try
     {
         // 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.ClearContent();
response.Clear();
response.ContentType = "text/plain";
response.AddHeader("Content-Disposition", "attachment; filename=" + FileName + ";");
response.TransmitFile(FilePath);
response.Flush();
response.End();

rgGiroPayments.Rebind();
this.Page_Load(null, null);

     }
catch()
{}
}

推荐答案

hi
遵循代码

hi
follow the code

if (!Page.IsPostBack)
        {
            //page will be refereshed at a interval of 10 sec
            Response.AddHeader("Refresh", "10");
        }


我建​​议您在iFrame/弹出窗口中执行文件下载功能,以便您之后可以在主页中工作也要下载文件,所以当您

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

Response.End();



它仅结束iFrame/popup 的响应对象,因此不结束主响应对象


如果它回答了您的问题,请将其标记为解决方案



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


在这种情况下没有出路.
响应结束后,我们将无法获得另一个响应,因为对一个请求只有一个响应.
因此,我在表单上添加了另一个按钮,单击该按钮将刷新我的页面.
用户必须单击按钮才能刷新页面.
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.


这篇关于从服务器端参考页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆