it shall be download a csv file,but nothing happend
You cannot download files using an AJAX request. The thing is that the AJAX request is being sent to the server and you are receiving the CSV on the client, inside the callback. But since this callback is running on the client you cannot prompt the user for saving the file, and even less save the file directly on the file system. That would be a huge security flaw.
What you should do instead is to provide the user with a single link pointing to your controller action so that he can download the CSV when he clicks on the link:
@Html.ActionLink("Download CSV", "MemberDayCSV", "Sum", null, null)
And if you want to pass some parameters to this controller action simply use the correct overload:
@Html.ActionLink(
"Download CSV",
"MemberDayCSV",
"Sum",
new {
date: "some date",
detail: "some detail",
conditionDisplay: "some condition display"
},
null
)
As an alternative you could also use an HTML form pointing to the same controller action:
@using (Html.BeginForm("MemberDayCSV", "Sum"))
{
@Html.Hidden("Date", "some date")
@Html.Hidden("Detail", "some detail")
@Html.Hidden("ConditionDisplay", "some condition display")
<button type="submit">Download CSV</button>
}