A newer version of this page is available. Switch to the current version.

GridViewSettings.SetEditFormTemplateContent(Action<GridViewEditFormTemplateContainer>) Method

Allows setting a template for displaying an edit form.

Namespace: DevExpress.Web.Mvc

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

Declaration

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

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 Example

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

See Also