如何在单击网格中的超链接时刷新网格 [英] How to refresh a grid on clicking a hyperlink in the grid

查看:117
本文介绍了如何在单击网格中的超链接时刷新网格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个网格,其中有一个名为filename的列,在其中添加了超链接.so,每当我们单击该文件时,文件就会使用以下代码打开.

Hi All,

I have a grid with a column called filename where I added hyperlink .so whenever we click on the file ,file opens using the following the code.

Response.ContentType = strFileType;
        Response.Clear();
        Response.AddHeader("Content-Disposition", "attachment; filename=" + fileName);
        Response.BinaryWrite(bytFile);
        Response.Clear();




我在同一gridview的另一列上称为下载时间..当用户单击超链接时,我需要更新此下载时间...
现在,我正在gridviewOnSelectedIndexchanged上更新gridview.
它甚至可以更新数据库中的时间.但是网格没有得到刷新.

简而言之,
1.发生点击事件时,我需要更新和刷新网格
2.应在另存为"对话框中打开文件.

打开文件后,控件不会返回到页面.

如果您有任何想法请帮助我.

在此先感谢




I have another column on the same gridview called downloaded time..i need to update this downloaded time when user clicks on the hyperlink...
Right now i am updating the gridview on gridviewOnSelectedIndexchanged.
Its even updating the time in database.but the grid is not getting refreshed.

In short,
1.I need to update and refresh the grid when a click event occurs
2.Should open the file in file save as dialog.

After opening the file,the control is not coming back to the page.

Please help me if you have any ideas.

Thanks in Advance

推荐答案

仅在重新加载页面时,网格才会刷新.您应该将链接指向javascript,这会打开下载,然后重新加载页面.
The grid will only refresh when the page reloads. You should make your link point to javascript which both opens the download, then reloads the page.


您需要更新GridView绑定的数据,然后在GridView上调用DataBind() .

同样,您似乎正在用文件数据替换响应.这就是为什么控件不返回页面"的原因.除了网页数据之外,您还需要返回文件数据.不过,我不太确定该怎么做...如果您无法解决该问题,则可能要问一个新问题以解决该特定问题.我想您可能不想调用Response.Clear(),但这只是一个猜测.
You need to update the data that your GridView is binding to then call DataBind() on the GridView.

Also, it looks like you are replacing the response with file data. That is why the "control is not coming back to the page". You will want to return file data in addition to the web page data. Not quite sure how to do that though... you may want to ask a new question to address that specific problem if you cannot figure it out. I imagine that you probably don''t want to call Response.Clear(), but that''s really just a guess.


这篇关于如何在单击网格中的超链接时刷新网格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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