Hi!
I got a little issue - i have a grid and 3 button (Edit1 , Edit2 and Save) -> when i click the button edit1 i set the grid's
grid.DisplayLayout.Bands[0].Override.AllowAddNew = AllowAddNew.TemplateOnBottom;
and on the InitializeTemplateAddRow I set the templateAddRow's cell 1 to AllowEdit and the other cells to NoEdit.
I do my edit thing, and when i click save i set
ulgProductQuantities.DisplayLayout.Bands[0].Override.AllowAddNew = AllowAddNew.No; Everything fine!
The problem is that if after that i click edit2, wich sould do the same thing just that for cell 2 of the templateAddRow, the event InitializeTemplateAddRow doesn't trigger, and the empty row that appears has the cell 1 on AllowEdit. Normally, on click edit2 it should have the cell 2 on AllowEdit.
Why doesn't the InitializeTemplateAddRow event doesn't trigger the second time?
Thank you!
Hi Hristo!
Thanks for your interest.
I've solved the issue.
Hi,
I just wanted to know if you were able to solve your issue based on Mike's suggestions or you still need help? Just let me know.
Thank you.
I assume you are setting some kind of flag in the button click to indicate what's happening, so that when InitializeTemplateAddRow fires, you know which column to enable. Is that right?
When the user begins typing into the TemplateAddRow, they are going to get another TemplateAddRow under it, and that row will be Initialized. So are you somehow ignoring that new row?
My best guess that the new TemplateAddRow which is created and initialized when the first TemplateAddRow is edited is being cached by the grid, and so when you turn the TemplateAddRow back on, it's already initialized and doesn't need to fire the event again.
The approach you are using here seems a bit odd. If you just want to add a single row to the grid, it would make more sense to use the AddNew method on the band rather than jumping through hoops to switch the TemplateAddRow on and then off again.