It does some wacky stuff on people's PCs, I dont know why, I think it it because they do not have *.csv associated with anything maybe. But, in C# I do other data and it works well. Question is, assuming my csv data inside the html variable is good, how do I open it in Excel, and possibly with a friendlier filename. It seems to make a wacky filename like "XXvZZr12HJ.csv.csv". I would be fine with a static filename like "hello.csv".
window.open('data:application/csv;charset=utf-8,' + encodeURIComponent(html));
Response.Clear(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.csv"); Response.Charset = ""; Response.ContentType = "application/text"; Response.Output.Write(sb.ToString()); Response.Flush(); Response.End();
From novice to tech pro — start learning today.