在函数执行后设置TextBox的值 [英] Set value of TextBox after function execution

查看:88
本文介绍了在函数执行后设置TextBox的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我尝试使用asp.net Web应用程序创建一个站点,但我无法继续因为,我无法在执行后将TextBox的值设置为完成函数文件下载。

 protected void Page_Load(object sender,EventArgs e)
{
if(!IsPostBack)
{
TextBox1.Text =start;
}
}

protected void Button1_Click(object sender,EventArgs e)
{
Response.ContentType =application / pdf;
Response.AppendHeader(Content-Disposition,attachment; filename = print_ordre.pdf);
Response.TransmitFile(Server.MapPath(〜/ print_ordre.pdf));
//Response.End();

TextBox1.Text =完成;
}





我等待你的帮助...

解决方案

< blockquote>这是不可能的,原因是你要编写两个流或ASP.NET执行



1.文件下载

2.页面回复



不可能同时执行这两项操作。更多详情请参阅此



http:/ /stackoverflow.com/questions/14760154/response-transmitfile-nothing-happening [ ^ ]



http://stackoverflow.com/questions/14744981/side-actions-not-happening-after-response-writefile/14745111#14745111 [ ^

hi everyone
I try to make a site with a asp.net web application, but I can't continue because, I can not set the value of TextBox to "finish" after the execution of a function file download.

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                TextBox1.Text = "start";
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            Response.ContentType = "application/pdf";            
            Response.AppendHeader("Content-Disposition", "attachment; filename=print_ordre.pdf");
            Response.TransmitFile(Server.MapPath("~/print_ordre.pdf"));
            //Response.End();

            TextBox1.Text = "finish";
        }



I await your help ...

It's not possible , the reason is there are two streams you are trying to write or ASP.NET performs

1. The filedownload
2. The Page response

It's not possible to do both of them. More details please refer this

http://stackoverflow.com/questions/14760154/response-transmitfile-nothing-happening[^]

http://stackoverflow.com/questions/14744981/side-actions-not-happening-after-response-writefile/14745111#14745111[^]


这篇关于在函数执行后设置TextBox的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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