Two datatables export at two different Excel CSV files
<p>You se finally I have 2 datatables filled with different data, now I have a button that allows me to send one datatable to a .CSV Excel file like this:</p>

<pre><code>string name="Dat_Agrup";
HttpContext context = HttpContext.Current;
context.Response.Clear();

foreach (System.Data.DataColumn column in _myDataTable.Columns)
{
    context.Response.Write("name"+ ",");
}

context.Response.Write(Environment.NewLine);

foreach (System.Data.DataRow row in _myDataTable.Rows)
{
    for (int i = 0; i &lt; _myDataTable.Columns.Count; i++)
    {
        context.Response.Write(row[i].ToString().Replace(",", string.Empty) + ",");
    }

    context.Response.Write(Environment.NewLine);
}

context.Response.ContentType = "text/csv";
context.Response.AppendHeader("Content-Disposition", "attachment; filename=" + name + ".csv");
context.Response.End();
</code></pre>

<p>Now this code works perfect it maybe missing some lines like where I declare the datatable but just trust me it works :D, now if I want to save the second datatable using the same code in the same action_button is those not work, i use this next code:</p>

<pre><code>string name2="Centroids";
HttpContext context2 = HttpContext.Current;
context2.Response.Clear();

foreach (System.Data.DataRow row in _myDataTable2.Rows)
{   
    for (int i = 0; i &lt; _myDataTable2.Columns.Count; i++)
    {
        context2.Response.Write(row[i].ToString().Replace(",", string.Empty) + ",");
    }

    context2.Response.Write(Environment.NewLine);
}

context2.Response.ContentType = "text2/csv";
context2.Response.AppendHeader("Content-Disposition", "attachment; filename=" + name2 + ".csv");
context2.Response.End();
</code></pre>

<p>It only save the first datatable and ignores the rest of the code can anyone explain the reason or why this happens, much appreciated any kind of help.</p>
