We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Best practice for auto generated primary key

What is the best practice for using a grid with a domain object that has an auto-generated primary key?
Setting the column to read-only or editable=false doesn't work because the field is still rendered.
In my case I am using NHibernate, and the primary key needs to be passed as NULL to create a new record.
Because the grid is expecting the primary key to be required, it will not allow a 'new item' form to be submitted unless the field has a value.
But if the field has a value, then NHibernate tries to update a record based on the primary key entered.
So as a workaround, I use a nullable int as the type for the primary key.
I feel there is a better way...
Anyone have a better idea?

2 Replies

JB Jeremy Branham September 4, 2013 12:35 AM UTC

So I can use the client event "OnActionSuccess" to hide the field, then the validation is not fired.

gridbuilder.ClientSideEvents(events =>


This is an acceptable workaround.

ES Eswari S Syncfusion Team September 17, 2013 09:19 AM UTC

Hi Customer,


Happy to hear that your issue has been solved by workaround.


Please let us know if you need  any other assistance.



Eswari S

Live Chat Icon For mobile
Up arrow icon