单击数据列表外部的按钮后尝试触发事件时出现错误。
每个语句都显示错误:集合已修改,枚举操作可能无法执行。
protected void btnSaveGrid_Click(object sender, EventArgs e)
{
foreach (DataListItem item in dlPl.Items)
{
CommandEventArgs commandArgs = new CommandEventArgs("SaveGrid", btnSaveGrid);
DataListCommandEventArgs repeaterArgs = new DataListCommandEventArgs(item,btnSaveGrid, commandArgs);
dlPl_ItemCommand(btnSaveGrid, repeaterArgs);
}
protected void dlPl_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "SaveGrid")
{
//Some work
}
}
谁能帮我?