verileri gridwiev e aktar daha sonra aşağıdaki kodu bir butonun eventine yaz excelle aktarmış olursun


HtmlForm form = new HtmlForm();

HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1254");
HttpContext.Current.Response.Charset = "windows-1254";

string dosya = "attachment;filename=ExcellListesi.xls";

Response.ClearContent();

Response.AddHeader("content-disposition", dosya);

Response.ContentType = "appliction/ms-excel";

StringWriter sw = new StringWriter();

HtmlTextWriter hw = new HtmlTextWriter(sw);

form.Controls.Add(grdListe);

this.Controls.Add(form);

form.RenderControl(hw);

Response.Write(sw.ToString());

Response.End();