I am displaying a panel that containg a button. When the user clicks the button, it does some processing and then downloads a file for the user. The code for that is shown here:
private void OpenForm(string content, string formName)
{
Byte[] bytes = System.Text.Encoding.Default.GetBytes(content);
this.Response.AppendHeader("Content-Type", "application/msword");
this.Response.AppendHeader("Content-Length", bytes.Length.ToString());
this.Response.AppendHeader("Content-disposition", "attachment; filename=" + formName);
this.Response.BinaryWrite(bytes);
ReturnToMemberScreen();
this.Response.Flush();
this.Context.ApplicationInstance.CompleteRequest();
}
In the function ReturnToMemberScreen, I am changing the visibility of some panels. Here is the function:
private void ReturnToMemberScreen()
{
this.panelMappings.Visible = false;
this.MemberEditPNL.Visible = true;
}
I can download the file perfectly fine, my issue is that the visibility of my panels don’t change. Does it have something to do with writing to the Response like I am?
Looking closer, I think I cannot make any changes to the page because I am changing the Content-Type of the response from “text/html” to application/msword when I do this:
As I result, I am making all my changes with CSS and Javascript instead. By default, I set my panels to either show or hide using css:
Then I set the
OnClientClickof the button to the following Javascript function to change the display: