Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

clear the textbox after redirect to a download page

$
0
0

i have 2 pages. main.aspx and download.aspx
page_load at download.aspx is to download a file
textbox and download button at main.aspx, button redirect to download.aspx, no function at page_load
 
after i filled the textbox and press the button, the page remain at main.aspx and file is downloaded from download.aspx.
now the problem is, how can i clear the textbox after i press the download button?
 
I tried:
1. this.Textbox1.Text = ""; before and after the redirect.
2. ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "document.getElementById('Textbox1').value =''", true); before and after the redirect
3. redirect to main.aspx after Response.Redirect("download.aspx");
 
none of the method above is working, what else can i try? and what is the problem? why the textbox cannot set to blank?

=========================== UPDATE =====================================

main.aspx

protected void Page_Load(object sender, EventArgs e)
{

}

protected void Button1_Click(object sender, EventArgs e)
{
   this.TextBox1.Text = "";
   Response.Redirect("download.aspx");
   this.TextBox1.Text = "";
}

download.aspx

protected void Page_Load(object sender, EventArgs e)
{
   string reportPath = "C:\\form.pdf";

   Response.ContentType = "appplication/pdf";
   Response.AppendHeader("Content-Disposition", "attachment; filename=form.pdf");
   Response.TransmitFile(reportPath);
   Response.End();
}




Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>