Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
85
Field must be from the same FieldLayout as the record Error when editing a DateTime Field in the template new record
posted

Hi,

I am receiving the error "Field must be from the same FieldLayout as the record" when binding the XamDataGrid to a list whereby default values have been added in InitializeTemplateAddRecord via SetCellValue, and when editing a datetime cell as the first cell. This occurs when i have assigned datasource to a second list after first being assigned to another list.

I have attached an example of this. In order to reproduce perform the following.

- I have 2 buttons and a grid on a form. One button assigns a List of Cars to the grid, Another button assigns a list of people to the grid.

- Click on the Bind Cars button, the grid is loaded with cars. The Field named 'Colour' is set to the default value of  "Blue" for the add new row template. Notice at this point i can happily create a new record by setting ManufactureDate and other field values.

- Click on the Bind People button, the grid is loaded with people. The Field named 'MaritalStatus' is set to the default value of "Single" for the add new row template. Attempt to create a new record by firstly setting the DateOfBirth.

The error "Field must be from the same FieldLayout as the record" is produced.

If all SetCellValue calls are removed from the InitializeTemplateAddRecord event handler, there is no error produced. I either need this error fixed or an alternate method of setting cell value defaults.

This was experienced in 10.2, 10.3 and 11.1

Thanks,

Andrew

TemplateRowBug.zip