hi,
I have a problem with WebHierarchicalDataGrid inside an UpdatePanel. I want to refresh the panel (and reload the grid data from the db) with a button click. This generally works, but if i expand some detail rows (manual load on demand) i get an error if i want to reload the grid. I did the same thing with UltraWebGrid (working), but i have to switch to WebHierarchicalDataGrid for better browser support.
[InvalidOperationException: Collection was modified; enumeration operation may not execute.] System.Web.UI.ControlCollectionEnumerator.MoveNext() +8798722 Infragistics.Web.UI.GridControls.ContainerGrid.EnsureChildControls() +783 System.Web.UI.Control.PreRenderRecursiveInternal() +42 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Control.PreRenderRecursiveInternal() +175 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496I'm attaching a sample project to demonstrate the problem. Steps to reproduce:1) click "Load" button.2) expand a detail row on the grid.3) click "Load" button -> error
Your code and the code you linked to simply does NOT work.
1) use your code: duplicate column key (because the columns don't get deleted on postback). if i clear() the columns first, nothing is shown.
2) use linked code: does not work because it sets columns only in inital post and not on postback ... template columns get set to nothing and disappear. the linked sample code can never work with postbacks because of this.
after a LOT of time wasted if finally found a solution. I'm using your posted code, clearing the columns collection before adding them anew. The important part is, I'm adding the columns to the GridView now, this seems to be the only way to make this work.
please check/update your sample codes to actually make them work.
Hello,
Please let me know if you have any further questions regarding this issue.
Hello WilhelmThe in your code you have forgotten to add the column in the event so it should look like this:
Private Sub WebHierarchicalDataGrid1_RowIslandDataBinding(sender As Object, e As Infragistics.Web.UI.GridControls.RowIslandEventArgs) Handles WebHierarchicalDataGrid1.RowIslandDataBinding
If e.RowIsland.DataMember = WebHierarchicalDataGrid1.DataMember Then
()
field1.Key =
"TemplateColumn1"
field1.Header.Text =
"haha"
.WebHierarchicalDataGrid1.Columns.Add(field1)
)
templateColumn1.ItemTemplate =
);
'itemplate = DirectCast(WebHierarchicalDataGrid1.Columns.FromKey("button2"), TemplateDataField)
'itemplate.ItemTemplate = New ButtonTemplate("hehe", "cmdB")
If
Sub
d At the moment this code wont work and when expandign will give you Async error. This is known issue and it is fixed, tested and awaits release. The next service release in which it will be solved is with scheduled date 9 November but note this date always may be changed due to unforeseen circumstances.
Hello Wilhelm,I am still investigatin the issue. I will update you with information withing the next few days.
I'm sorry, but this is not working at all. If i use the the RowIslandDataBinding event handler the template columns do not show up at all. Not to mention that in the sample they do not set the itemtemplate on postback, so this could not work ever because itemtemplate is always nothing on postback.
attaching new sample.