Click to See Complete Forum and Search --> : Cannot show the textarea


dummyagain
December 25th, 2006, 11:09 PM
I have written a button, clicking on it will make the textarea visible.
The following code will work.

protected void exportHTML_Click(object sender, EventArgs e)
{
htmlArea.Visible = true;
}


However, the textarea cannot be shown in the following code

protected void exportHTML_Click(object sender, EventArgs e)
{
htmlArea.Visible = true;

Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=FileName.htm");
Response.Charset = "";
Response.ContentType = "text/html";
StringBuilder SB = new StringBuilder();
System.IO.StringWriter stringWrite = new System.IO.StringWriter(SB);
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
gvTopic.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();

}


I would like to know why the second code cannot show the text area.. the file generation code should not able to affect that i think .

Thank you

jasonli
December 27th, 2006, 08:47 AM
That's because of "Response.Clear();".

RobDog888
December 27th, 2006, 03:13 PM
You will have to add it to the page again. Is there any reason for the need of clearing? Can you do it without clearing?