The requested page is not available for the requested platform. You are viewing the content for Default platform.

GridSettingsBase.KeyFieldName Property

Gets or sets the name of the data source key field.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v19.2.dll


public string KeyFieldName { get; set; }
Public Property KeyFieldName As String

Property Value

Type Description

A String value that specifies the name of the data source key field.


The KeyFieldName property should be specified when using the following GridView extension features:

  • data editing;
  • adding new and deleting existing rows;
  • selecting rows;
  • master-detail view;
  • endless paging.
  • The values contained in the key field must be unique.
  • It is not possible to use the edit form to update a key field value.

The GridSettingsBase property supports a composite KeyFieldName property value. You can use semicolon-separated values to specify multi-field keys, for example:

    settings => {
        settings.KeyFieldName = "id1;id2";


@Html.DevExpress().GridView(settings => {
    settings.Name = "gvDataBindingToLinq";
    settings.CallbackRouteValues = new { Controller = "DataBinding", Action = "DataBindingToLargeDatabasePartial" };
    settings.KeyFieldName = "ID";
}).BindToEF(string.Empty, string.Empty, (s, e) => {
    e.QueryableSource = LargeDatabaseDataProvider.DB.Emails;

Online Demo

See Also