单击“图像"按钮上的多个工作 [英] Multiple work on Image button click

查看:95
本文介绍了单击“图像"按钮上的多个工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有图像按钮.
单击后,我要下载文件以及将标签文本更改为谢谢您下载".

这是代码:

I have am image button.
On click of which I want to download file as well as change a label text to "thank you for downloading".

Here is the code:

Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
    lblDownload.Text = "thax"
    Response.ContentType = "image/zip"
    Response.AppendHeader("Content-Disposition", "attachment; filename=cde_setup.zip")
    Response.TransmitFile(Server.MapPath("~/Products/CDE/cde_setup.zip"))
    IsDownloaded = True
    Response.End()
    lblDownload.Text = "Thank you for downloading"

End Sub


当我单击图像按钮时,下载开始,但标签文本不会更改.如果我除去标签以外的代码,则标签文本也会更改.


When i am clicking on the image button the download starts but label text does not get change. if i remove code apart from label then label text changes.

推荐答案

您需要了解如何构建和呈现Page.

响应是向您显示页面的响应.您在更改标签之前使用了Response.End,因此标签行没有影响.
You need to know how a Page is build and rendered.

Response is the one that presents the page to you. You are using Response.End before changing the label and thus there is no affect of label line.


您好Sandeep感谢您的答复,但是当我写行更改标签时问题仍然存在response.end之前的文本.
所以我写了一行代码,以更改上面代码中response.end上方的文本.但没有改变.
Hi Sandeep thank you for responding but the problem remain same when i write the line to change label text before response.end.
So i wrote the line to change the text above response.end in the above code. but did not change.


这篇关于单击“图像"按钮上的多个工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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