I have an UltraWinGrid on my form which is bound to an UltraDataSource. The schema is a primary band with one child band. My objective is to enable the user to only add new rows to the child band if the form is in edit mode.
I have the UI of the grid setup so that when the form loads, the Add Row for the child band is invisible. I accomplished this by setting the AllowAddNew property of the child band to AllowAddNew.No at design time. However, when the user clicks edit on the form's toolbar, I'd like to display the Add Row by setting its AllowAddNew property to AllowAddNew.TemplateOnBottom.
This works great if any of the primary rows already has one or more child rows. In that case, an Add Row is correctly displayed at the bottom of each child row collection, including those empty child row collections belonging to the primary rows with no child rows. In other words, I can expand any of the primary rows at this point and it will have at least one child row: namely, the Add Row. However, if none of the primary rows contains any child rows, no Add Rows are displayed at all so that the user is unable to add new child rows to any of the primary rows. Attempting to expand the primary rows in this case only makes the expansion indicator invisible as if there are no child rows, not even an add row. Is there a way to guarantee that the add rows will be displayed?
I decided to take a different approach where the Add Rows are not invisible, but just disabled. This appears to work well and I believe is a better solution.