ASP.NET保存文件对话框不允许我重置隐藏字段 [英] ASP.NET save file dialog is not allowing me to reset hidden Field

查看:53
本文介绍了ASP.NET保存文件对话框不允许我重置隐藏字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用于下载文件的代码,它可以工作,但是在执行此代码之前,我会重置隐藏字段的值,但是问题是它没有被重置.请注意,当我停止调用下载方法时,将重置隐藏字段的值.那么如何在保存文件对话框出现之前强制重置?

这是代码示例:

I have a code for downloading a file and it works but before executing this code iam resetting the value of the hidden field, but the problem is that it is not being reset. Note that when i stop calling the download method the value of hidden field is reset. So how can i force resetting before save file dialog appears ?

Here is a sample of the code :

If HF_DoDownloadSample.Value = 1 Then
            HF_DoDownloadSample.Value = 0
            ScriptManager.RegisterStartupScript(UpdatePanel1, Me.UpdatePanel1.GetType(), "alert", "alert('your comment is posted and waiting for approval to appear for public');", True)
            DownloadSample()
        End If



注意:DownloadSample()是正在下载文件的函数.



Note: DownloadSample() is the function that is downloading the file.

推荐答案

尝试将隐藏字段放在更新面板中,并将其UpdateMode属性设置为Always.或者,如果您希望保留其属性为条件,则可以在下载之前调用更新面板的更新方法.
Try putting your hidden field in update panel, and set its UpdateMode property to Always. OR if u want to keep its propery as conditional, then you can call update method of update panel before your download.


这篇关于ASP.NET保存文件对话框不允许我重置隐藏字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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