GridViewSettings.SetEditFormTemplateContent(Action<GridViewEditFormTemplateContainer>) Method

Allows setting a template for displaying an edit form.

Namespace: DevExpress.Web.Mvc

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


public void SetEditFormTemplateContent(
    Action<GridViewEditFormTemplateContainer> contentMethod
Public Sub SetEditFormTemplateContent(
    contentMethod As Action(Of GridViewEditFormTemplateContainer)


Name Type Description
contentMethod Action<GridViewEditFormTemplateContainer>

A method to which a template content rendering is delegated.



Once a template defined using the SetEditFormTemplateContent method is created, it is instantiated within a container object of the GridViewEditFormTemplateContainer type. This container object exposes a set of members which can be useful when designing a template.


    settings =>
        settings.Name = "grid";
        settings.KeyFieldName = "PersonID";
        settings.CallbackRouteValues = new { Controller = "Home", Action = "GridViewEditingPartial" };
        settings.ClientSideEvents.BeginCallback = "OnBeginCallback";
        if (ViewBag.IsNewRow != null)
            if (ViewBag.IsNewRow == true)
                settings.SetEditFormTemplateContent(c =>
                    ViewContext.Writer.Write("EditForm Template Content");

Online Example

GridView - How to specify an EditForm template only when adding a new row

See Also