Mahesh Babu

Mahesh Babu

  • NA
  • 118
  • 30.5k

How to generate the data from gridview to excel

Aug 29 2018 1:38 AM
How to generate the data from grid view to excel
 
My Requirement is 
 
How to generate the data from gridview to excel 
i created my datatable 
 
i need to generate the data randomly when i click the button to the excel
 
below u can find the code
 
private DataTable GetDetails(int id)
{
_dt = new DataTable();
_da = new SqlDataAdapter("sp_GetDetails", _con);
_da.SelectCommand.Parameters.AddWithValue("@id", id);
_da.SelectCommand.CommandType = CommandType.StoredProcedure;
_dt.Clear();
_da.Fill(_dt);
return _dt;
}
 
please help me this 
 
Thanks 

Answers (3)