سلام.
من یک قطعه کدی دارم که به ازای هر کد استانی که دارم اطلاعات مربوط به آن استان را به اکسل منتقل می کند.اما یک ایرادی داره که وقتی اطلاعات استان اول را نشان میدهد از حلقه for خارج میشود.کسی میدونه چرا؟؟؟
List<EdarateKol> eks = edarehKolRepository.GetEdarehkol();
foreach (var codeedare in eks)
{
List<sp_Getz100p_Result> spr = sadpRepository.GetCode(Convert.ToInt32(codeedare.code));
gv.DataSource = spr;
gv.DataBind();
gv.HeaderRow.BackColor = Color.LightGray;
foreach (TableCell cell in gv.HeaderRow.Cells)
{
cell.BackColor = gv.HeaderStyle.BackColor;
}
foreach (GridViewRow row in gv.Rows)
{
row.BackColor = Color.LightBlue;
foreach (TableCell cell in row.Cells)
{
if (i % 2 == 0)
{
cell.BackColor = gv.AlternatingRowStyle.BackColor;
}
else
{
cell.BackColor = Color.White;
}
cell.CssClass = "textmode";
i++;
}
}
gv.RenderControl(hw);
Response.ContentType = "text/rtf; charset=UTF-8";
Response.Charset = "UTF-8";
Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.Write("<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />" + sw.ToString());
Response.End();
}
هیچ کاربری تا کنون از این پست تشکر نکرده است
با ما تماس بگیرید تا در این مسیر همراهتان باشیم :)