我有gridview(Telerik RadGrid),它根据SP返回的数据在飞行中生成。我需要将其数据导出到循环内的excel。目前我有
CheckBoxList cbl = (CheckBoxList)FindControl("eqtypes");
for (int i = 0; i < cbl.Items.Count; i++)
{
if (cbl.Items[i].Selected)
{
Getdata(arg, -1);
GridView1.Rebind();
GridView1.ExportSettings.ExportOnlyData = true;
GridView1.ExportSettings.IgnorePaging = true;
GridView1.ExportSettings.OpenInNewWindow = true;
GridView1.ExportSettings.FileName = cbl.Items[i].Value;
GridView1.MasterTableView.ExportToExcel();
}
}
Getdata(arg, -1); // is the methood that pulls the correct data based on the item selected in the checkboxlist.
一切都很好,除非我导出时我只获得最后一个选定的项目数据,只有一个应用的文件。我需要为每个选定的项目导出一个文件。看起来像是一个回发问题。解决方法是什么?