Hi Everyone,
Can somebody please help me with this.
I have this gridview and I have binded it properly,
now I have a button and I want to export the data inside the datagrid to excel.
I can do this in asp.net because the code is quite easy for the webform
but I am having a hard time in C# and it is a standalone application
I have googled it and found no step by step tutorial
I hope someone can help me
Thank you in advance.

I find this code after searching check this one

string status = PolicyStatusDrpDown.SelectedIndex.ToString()=="0"?"open":"close";
Response.Buffer= true;
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment;filename="+objRLPCompanyInfo.CompanyAlias+" "+status+" "+DateRangeType.SelectedItem.ToString()+" "+System.DateTime.Today.ToLongDateString()+".xls");
Response.Charset = "";
this.EnableViewState = false;

System.IO.StringWriter oStringWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter oHtmlTextWriter = new System.Web.UI.HtmlTextWriter(oStringWriter);

details you can check this link it contains a sample applicaiton