I have a templated column that shows a usercontrol inside it. When the user types inside the control, hidden cells (three of them) get loaded with the data. Everything works fine until I delete a row (fires DeleteRow) but the event is cancelled on the server because of a business rule. I set e.Cancel = true and the deleted row reappeares, but the data is missing in my custom control (but it is present in the auxiliary hidden cells). I found out it's because the InitializeRow event does not get fired (that's where I load the data into my control when getting it from the database). So I tried moving my code to PreRender, but then I found out that when I get my control using
For Each grRow As UltraGridRow In Me.Rows
cellCak = grRow.Cells.FromKey(
"field")
cak =
DirectCast(DirectCast(DirectCast(cellCak.Column, TemplatedColumn).CellItems(grRow.Index), CellItem).FindControl("controlName"), MyControl)
the control I get belongs to a different row! I think the problem is in CellItems(grRow.Index) may use the index PRIOR to rendering, but Me.Rows has different indexes (this is just a theory.
Anyway, how do I solve this problem? All I want to do is set back the values the user entered... ;(