public void DisplayBookingReport() { DataSet dsBook = objReport.DisplayBookingReport(); if (dsBook.Tables[0].Rows.Count > 0) { Gvboooking.DataSource = dsBook.Tables[0]; Gvboooking.DataBind(); } }
protected void btnPdf_Click(object sender, EventArgs e) { Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=DocumentReport.pdf"); Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/pdf"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); Gvboooking.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.End(); }