Note that there are some explanatory texts on larger screens.

plurals
  1. POto output CSV file for pop-up window using C# in ASP.Net
    primarykey
    data
    text
    <p>I try to output CSV file in pop-up window. I can output CSV in main window, but not in pop-up. I use same code. For example; I use a form to output CSV file. When this form is main window, can output CSV file. When I use this form as a pop-up, it can't output. How can I do?</p> <p>It is my CSV output function:</p> <pre><code>public void OutputCSV(DataTable dtValue, string strFilename) { if (TextUtility.IsNullOrEmpty(strFilename)) { throw new I01Exception(Enums.ExType.System, "9909_35"); } DataTable dt = dtValue; StringBuilder sb = new System.Text.StringBuilder(); string strCh = ","; //項目名 for (int k = 0; k &lt; dt.Columns.Count; k++) { sb.Append("\"" + dt.Columns[k].Caption + "\"" + strCh); } sb.Remove(sb.Length - 1, 1); //データ foreach (DataRow row in dt.Rows) { sb.AppendLine(string.Empty); for (int i = 0; i &lt; dt.Columns.Count; i++) { sb.Append("\"" + row[i].ToString() + "\"" + strCh); } } HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Buffer = true; HttpContext.Current.Response.AppendHeader("content-disposition", string.Format("attachment; filename={0}", HttpUtility.UrlEncode(strFilename + ".csv"))); HttpContext.Current.Response.ContentType = "text/comma-separated-values"; HttpContext.Current.Response.ContentEncoding = Encoding.GetEncoding("shift-jis"); HttpContext.Current.Response.Write(sb.ToString()); HttpContext.Current.Response.Flush(); HttpContext.Current.ApplicationInstance.CompleteRequest(); HttpContext.Current.Response.End(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload