I ran into an issue using NHibernate + domain objects with the Syncfusion grid.
I am using an auto incremented [generated identity] integer primary key that NHibernate expects to be null when creating a new item.
With the syncfusion grid, the primary key is a required field on the “add new” form/dialog by default.
To avoid the requirement of supplying a value in the “add new” form, you can hide the parent div of the primary key input item by using the “OnActionSuccess” client event.
@(Html.Syncfusion().Grid("GenericListGrid") .ClientSideEvents(events => { events.OnActionSuccess("HideOnAdd"); }); )
Then the javascript function to hide the field from validation…
In this case, the field mapping is “Id”.
function HideOnAdd(sender, args) { alert(args.RequestType); if (args.RequestType == 'AddNew') { var gridObj = $('#GenericListGridEditDialog'); gridObj.find('#Id').parent().css('display', 'none'); } }
If you are using a different edit method, the name of the form or dialog could be a different format.