I am having this code...
public void ExportClientsListToExcel()
{
    var grid = new System.Web.UI.WebControls.GridView();
    grid.DataSource = db.GetCompleteEmpReport();
    grid.DataBind();
    Response.ClearContent();
    Response.AddHeader("content-disposition", "attachment; filename=Exported_Diners.xls");
    Response.ContentType = "application/excel";
    StringWriter sw = new StringWriter();
    HtmlTextWriter htw = new HtmlTextWriter(sw);
    grid.RenderControl(htw);
    Response.Write(sw.ToString());
    Response.End();
}
where in I am getting the stored procedure data,populating the grid and then getting the Exported to Excel.It does not give me any error but not getting the required Exported file.Where I have gone wrong?
I am getting the required data in sw.ToString() part but not getting exported. I am calling that method by ajax Post call on the client side and have this code
  $("#btnExport").click(function (event) {
        $.ajax({
            url: 'Home/ExportClientsListToExcel',
            type: 'POST',
            success: function (status) {
                alert();
            },
        });
    });
The alert() popup is also coming.