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

EditMode exclude Primarykey to be posted as 0?

Hi,
when i use editmode asDialog, it display Id which is PK in the dialog and when i save it, it will post as 0. this cause modalstate.IsValid=false. is there anyway to omit this field or fix it somehow?
public partial class FeedBack
{
[Key]
public int id { get; set; }
}
@(Html.EJ().Grid("Grid")
.Datasource((IEnumerable)Model)
.Datasource(dataSource => dataSource.Json((IEnumerable
)Model).UpdateURL("/FeedBacks/Edit")
.InsertURL("/FeedBacks/Create").RemoveURL("/FeedBacks/Delete").Adaptor(AdaptorType.RemoteSaveAdaptor))
.AllowSorting()
.AllowFiltering()
.AllowResizeToFit()
.AllowResizing()
.FilterSettings(filter => { filter.FilterType(FilterType.Excel); })
.EditSettings(edit => { edit.AllowAdding().AllowDeleting()
.AllowEditing().ShowDeleteConfirmDialog().EditMode(EditMode.Dialog); })
.ToolbarSettings(toolbar =>
{
toolbar.ShowToolbar().ToolbarItems(items =>
{
items.AddTool(ToolBarItems.Add);
items.AddTool(ToolBarItems.Edit);
items.AddTool(ToolBarItems.Delete);
items.AddTool(ToolBarItems.Update);
items.AddTool(ToolBarItems.Cancel);
}).CustomToolbarItems(new List<object>() { new Syncfusion.JavaScript.Models.CustomToolbarItem() { TemplateID = "#Details" } });
}).ClientSideEvents(eve => eve.Create("create").ToolbarClick("ToolBarClick"))
.Columns(col =>
{
col.Field("id").HeaderText("ID").Width(50).IsPrimaryKey(true).AllowEditing(false).Add();


1 Reply

LR Logesh Rajappa Syncfusion Team January 14, 2019 11:17 AM UTC

Hi Emil, 

Greetings from Syncfusion. 

Query :  when i use editmode as Dialog, it display Id which is PK in the dialog 
 
From your query we suspect that you would like to hide a ‘id’ column when editing a grid row using dialog editing. Please refer to the below documentation to achieve your requirement, 
 
 
If we have misunderstood your query, then please get back to us with more information about the query in detail. 
 
Regards, 
Logesh Rajappa 


Loader.
Up arrow icon