62,268
社区成员
发帖
与我相关
我的任务
分享
public FileResult Export(int deptID)
{
Department dept = DepartmentBLL.GetDepartment(deptID);
string fileName = dept.Name + "人员表.xls";
string filePath = Server.MapPath("..\\Temp\\" + fileName);
ExcelBLL.EmployeeToExcel.CreateEmployeesExcel(filePath, dept);
string contentType = "application/ms-excel";
return File(filePath, contentType, fileName);
}
$("#btnExport").click(function () {
if ($("#inputRole").val() != "2") {
jAlert("该用户没有管理员权限,请用管理员账号登陆!", "提示");
return;
};
var deptID = $('#query_select_dept').val();
if (deptID == "0") {
jAlert("请选择部门!", "提示");
return;
}
document.location.href = "/Employee/Export?deptID=" + deptID;
});
ActionResult,其中第四行为生成Excel文件,但是在Chrome中下载正常,下载文件为"xxx.xls",可是在ie8中,下载的文件就变成了"Export",成了我的FileResult的名字,请高人解惑。