サーバー側では、次のコードがあります。
protected void DownloadExcel(object sender, EventArgs e)
{
byte[] arrayExcel = Convert.FromBase64String(reportBase64.Value);
HttpContext.Current.Response.ClearContent();
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearHeaders();
HttpContext.Current.Response.AppendHeader("content-length", arrayExcel.Length.ToString());
HttpContext.Current.Response.AppendHeader("content-disposition", "attachment;filename=excelName.xls");
HttpContext.Current.Response.ContentType = "application/Excel";
HttpContext.Current.Response.BinaryWrite(arrayExcel);
HttpContext.Current.Response.End();
HttpContext.Current.Response.Close();
HttpContext.Current.Response.Flush();
}
このメソッドは、この小さなjsによって発生する「OnValueChanged」イベントにバインドされます。
self.getExcel = function (stringBase64) {
$("#hiddenFiedlName").val(stringBase64).change();
__doPostBack();
}
イベントが最初にトリガーされた後、すべてのポストバックで発生します。この奇妙な振る舞いは、jsコードによって変更された「変更トリガー」が実際のポストバックによってクリアされないために発生すると思いました。
さて、私の仮定は正しいですか?もしそうなら、この「変更」トリガーをプログラムでクリアする方法はありますか?
ありがとうございました
編集1:私が書いていた「すべてのポストバック」は、同じページの他のボタンによってトリガーされる他のファイルのダウンロードです。