//protected void lbdelete_Click(object sender, EventArgs e) //{ // try // { // ImageButton btndetails = sender as ImageButton; // GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer; // hdnfield.Value = gvrow.Cells[2].Text; // // Label2.Text = "Are you sure you want to delete this Record?"; // ModalPopupExtender2.Show(); // } // catch (Exception ex) // { // lblmsg.Text = ex.Message; // } //} //protected void chkActive_CheckedChanged(object sender, EventArgs e) //{ // GridViewRow row = (sender as CheckBox).Parent.Parent as GridViewRow; // CheckBox chkactive = (CheckBox)row.FindControl("chkActive"); // InventoryServiceClient lclsService = new InventoryServiceClient(); // Int64 CreatedBy = Convert.ToInt64(defaultPage.UserId); // if (chkactive.Checked == true) // { // lclsService.DeleteItemCategory(Convert.ToInt64(row.Cells[1].Text), CreatedBy, true); // } // else // { // lclsService.DeleteItemCategory(Convert.ToInt64(row.Cells[1].Text), CreatedBy, false); // ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.ItemCategoryDeleteMessage.Replace("<<ItemCategory>>", row.Cells[2].Text.Trim()), true); // } // bindgrid(); //} protected void btnprint_Click(object sender, EventArgs e) { lcls.SearchItem = txtitemcategory.Text; lcls.IsStrActive = reactive.SelectedValue; lcls.LoggedinBy = defaultPage.UserId; List <GetCategoryReport_Result> llstreview = lclsService.GetCategoryReport(lcls).ToList(); rvitemcategoryreport.ProcessingMode = ProcessingMode.Local; rvitemcategoryreport.LocalReport.ReportPath = Server.MapPath("~/Reports/ItemCategoryReport.rdlc"); ReportDataSource datasource = new ReportDataSource("ItemCategoryReportDS", llstreview); rvitemcategoryreport.LocalReport.DataSources.Clear(); rvitemcategoryreport.LocalReport.DataSources.Add(datasource); rvitemcategoryreport.LocalReport.Refresh(); Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] bytes = rvitemcategoryreport.LocalReport.Render("PDF", "", out mimeType, out encoding, out extension, out streamids, out warnings); Guid guid = Guid.NewGuid(); string path = ConfigurationManager.AppSettings["TempFileLocation"].ToString(); _sessionPDFFileName = "ItemCategory" + guid + ".pdf"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } path = Path.Combine(path, _sessionPDFFileName); using (StreamWriter sw = new StreamWriter(File.Create(path))) { sw.Write(""); } FileStream fs = new FileStream(path, FileMode.Open); // byte[] data = new byte[fs.Length]; fs.Write(bytes, 0, bytes.Length); fs.Close(); ShowPDFFile(path); }