Code for Data Export from GridView to Excel in Asp.Net- c#
In this blog, I am going to show how we could export our data from a gridview to excel sheet in Asp.net- c# (Export to excel data) First of all, just take a gridview on your design page and fill data as below :: protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindGrid(); } } protected void BindGrid() { gvDetails.DataSource = this.getData(); gvDetails.DataBind(); } private DataTable getData() { DataTable dt = new DataTable(); dt.Columns.Add("UserId", ...