// Download all Battery data as a CSV protected void DownloadBtn_Click(object sender, EventArgs e) { int batchId = 0; try { batchId = Int32.Parse(Security.GetQueryString()); } catch { Security.RedirectToHomePage(); } if (BatchService.DownloadSpreadsheet(batchId)) { // Do nothing } else { Response.Redirect("BatchDetail.aspx?id=" + batchId + "&message=DownloadError"); } }