我正在尝试下载已检查的 gridview 记录。Gridview 包含图像和数据。数据正在下载到 Excel 工作表中。问题是当我检查要下载的 griview 的记录时。只有最后检查的记录会被下载。所有都没有被下载。我想我应该使用一个数组。但请帮我这样做:
BubnaManager manager = new BubnaManager();
int count = GridAssigned.Rows.Count;
var data = (List<ProductImageMapWrapper>)null;
for (int i = 0; i < count; i++)
{
HiddenField ImageId = GridAssigned.Rows[i].FindControl("hdn_id2") as HiddenField;
int ImId = Convert.ToInt32(ImageId.Value);
CheckBox chkIDLabel = GridAssigned.Rows[i].FindControl("NewCheckBoxImage") as CheckBox;
if (chkIDLabel.Checked == true)
{
TextBox txtCompany = GridAssigned.Rows[i].FindControl("TextBoxCompany") as TextBox;
TextBox txtBrand = GridAssigned.Rows[i].FindControl("TextBoxBrand") as TextBox;
HiddenField hdBrand = GridAssigned.Rows[i].FindControl("newhdBrand") as HiddenField;
HiddenField hdCompany = GridAssigned.Rows[i].FindControl("newhdCompany") as HiddenField;
int brandid = bm.getIdbyBrand(txtBrand.Text);
int CompanyId = bm.getIdbyCompany(txtCompany.Text);
data = manager.GetSearchResultForAssignedProductImageMap1(ImId, CompanyId, brandid);
}
}
if(data.count!=0)
{
// code for downloading
}