Empty Excel only headers

Sep 18, 2013 at 9:42 PM
I import an excel file as an gridview1.From this grid I create another grid.In first grid I have got the same records in the excel file. In the other grid I have got wrong records..When I press the button I check the number and create a new datatable.At the end equals dt to data source of gridview2..But I press export to excel button All I see is the header in the excel..
    DataTable dt = new DataTable();
    DataRow dr;

    dt.Columns.Add(new DataColumn("ADI"));
    dt.Columns.Add(new DataColumn("SOYADI"));


    foreach (GridViewRow row in GridView1.Rows)
    {
        dr = dt.NewRow();
        dr["NAME"] = HttpUtility.HtmlDecode(row.Cells[0].Text.ToString());
        dr["PHONE"] = HttpUtility.HtmlDecode(row.Cells[1].Text.ToString());

        Boolean sonuc = isPhoneExists(row.Cells[1].Text, out hata);

        if (sonuc)
        {
            dt.Rows.Add(dr);
        }
        else
        {

         do something

        }



    }


    GridView2.DataSource = dt;


    GridView2.DataBind();
Sep 20, 2013 at 7:58 PM
Please help me...