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

Extract Editor Template (MVC)

Extracts the selected code to create a new editor template.

Availability

Available from the context menu or via shortcuts:

  • when the part of an MVC view code containing an editor is selected.

Examples

<!--Index.cshtml-->
<div>
@{Html.DevExpress().TextBox(s =>
  {
    s.Name = ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName("UserName");
    s.Width = Unit.Percentage(100);
  }).Bind(Model.UserName).
Render();
}
</div>

Result:

<!--EditorTemplate.schtml-->
@model System.String
@using System.Web.UI.WebControls;
@{Html.DevExpress().TextBox(s =>
        {
            s.Name = ViewContext.ViewData.TemplateInfo.GetFullHtmlFieldName("UserName");
            s.Width = Unit.Percentage(100);
        }).Bind(Model).
      Render();
}

Screenshot

CSharpExtractEditorTemplate