protected void btnConfirm_Click(object sender, EventArgs e) { try { prodObj = new ProductClass(); DataTable dtExcel = (DataTable)ViewState["ExcelData"]; if (dtExcel.Rows.Count > 0) { int insert = prodObj.SaveProductByExcel(dtExcel); if (insert > 0) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "script", "successfull('" + insert + " ','Products added Successfully.')", true); btnConfirm.Visible = false; btnUpload.Visible = true; btnDownload.Visible = true; tbl.Visible = false; } } } catch (Exception ex) { ex.Message.ToString(); } }