R
Ralf Müller
Hi all!
any ideas why this code...
protected override void Render(HtmlTextWriter writer) {
Table table;
TableRow row;
TableCell cell;
table = new Table();
foreach(ListElement e in Controls) {
row = new TableRow();
cell = new TableCell();
cell.Controls.Add(e);
row.Cells.Add(cell);
table.Rows.Add(row);
}
table.RenderControl(writer);
}
.... produces the following Exception in my ListElementCollection (Composite
Control):
"System.InvalidOperationException: Die Liste, an die der Enumerator gebunden
ist, wurde geändert. Ein Enumerator kann nur verwendet werden, wenn die
Liste nicht geändert wird."
Sorry - I got the german language version of Visual Studio. It says that the
List the Enumerator is bound to has been altered and that an Enumerator can
only be used when the List is not altered. - But WHY ON EARTH is my Controls
Collection altered while my Control is being rendered???
Greetings, Ralf
any ideas why this code...
protected override void Render(HtmlTextWriter writer) {
Table table;
TableRow row;
TableCell cell;
table = new Table();
foreach(ListElement e in Controls) {
row = new TableRow();
cell = new TableCell();
cell.Controls.Add(e);
row.Cells.Add(cell);
table.Rows.Add(row);
}
table.RenderControl(writer);
}
.... produces the following Exception in my ListElementCollection (Composite
Control):
"System.InvalidOperationException: Die Liste, an die der Enumerator gebunden
ist, wurde geändert. Ein Enumerator kann nur verwendet werden, wenn die
Liste nicht geändert wird."
Sorry - I got the german language version of Visual Studio. It says that the
List the Enumerator is bound to has been altered and that an Enumerator can
only be used when the List is not altered. - But WHY ON EARTH is my Controls
Collection altered while my Control is being rendered???
Greetings, Ralf