This is a tough lesson learned for me. Figured I’d post my findings in the event someone else encounters similar issues.
Never hide the datagrid component on your form
Under no scenario, should you hide a datagrid based on another property. Or just hide the datagrid in general. If you do this, problems occur. In my case, the first row was showing up blank after the grid moved to a visible state.
Datatable object columns must all be mapped to DataGrid columns:
The second thing i discovered (or i think i did) was that you have to bind every datatable column to a data grid column, and hide those columns that you don’t want the user to see. IF you attempt to just add the columns you want, and having the datagrid bound to a datatable that has more columns, it may display fine, but if you want to update data out of it, the datatable renders to null once clicking on a button to send it for additional processing.
Ensure Columns in your datatable, align to the columns in your data grid (Column 1 in your data table, should be Column 1 in your data grid etc)
If you do not map for column to column in the right order, when the datatable comes out of the form for further processing, the data is collected and updated based on an ordinal position. So if i had CustomerName as the first column in my datatable bound to a datagrid, and my first column in my datagrid is CustomerPhoneNumber, if i update the the Customer Phone field in my datagrid, it writes the phone number into the CustomerName field in my datatable.
I’ve spent a considerable amount of time on this component, and it’s essential for an attended experience. I’m pretty sure I’ve kicked over every stone, but in the process, items 2 and 3 above may have been an issue with the various troubleshooting steps i’ve taken. So it may or may not be an issue, but if you find yourself rowing with one oar on this matter, try aligning columns in your datatable to the datagrid.
Hope this does some good for someone in the future!