Skip to main content

GridViewSettings.SetEditFormTemplateContent(Action<GridViewEditFormTemplateContainer>) Method

Allows you to specify an edit form template.

Namespace: DevExpress.Web.Mvc

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

Declaration

public void SetEditFormTemplateContent(
    Action<GridViewEditFormTemplateContainer> contentMethod
)

Parameters

Name Type Description
contentMethod Action<GridViewEditFormTemplateContainer>

A method to which a template content rendering is delegated.

Remarks

Note

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.

Example

@Html.DevExpress().GridView(
    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");
                });
    }
).Bind(Model).GetHtml()

Online Examples

View Example: How to Specify a Custom Edit Form Template

View Example: How to create a custom edit form for new rows

See Also