User77

User77

  • NA
  • 52
  • 27.6k

Change Default Chart place in .xls format excel in asp.net

Nov 3 2016 6:59 AM
 
I am displaying chart above image it hides grid view control and i need to display below image how can i do this.
 
 
My code export code is:
 protected void btnExport_Click(object sender, EventArgs e)
{
   string imgPath2 = Request.Url.GetLeftPart(UriPartial.Authority) +       VirtualPathUtility.ToAbsolute("~/" + tmpChartName);
   Response.ClearContent();
   Response.Buffer = true;
   Response.AddHeader("content-disposition", string.Format("attachment; filename={0}",  "MediCountReport.xls"));
  Response.ContentType = "application/ms-excel";
  StringWriter sw = new StringWriter();
  HtmlTextWriter htw = new HtmlTextWriter(sw);
  string headerTable = @"<Table><tr><td><img src='" + imgPath2 + @"' \></td></tr></Table>";
  Response.Write(headerTable);
  Response.Cache.SetCacheability(HttpCacheability.NoCache);
  GridView1.AllowPaging = false;
  BindGridview();
  GridView1.HeaderRow.Style.Add("background-color", "#F5FFFA");
  for (int i = 0; i < GridView1.HeaderRow.Cells.Count; i++)
  {
  GridView1.HeaderRow.Cells[i].Style.Add("background-color", "#DCDCDC");
  }
  GridView1.RenderControl(htw);
  Response.Write(sw.ToString());
  Response.End();
}
Please help me out.
Thank you

Answers (1)