Extract Editor Template (MVC)
In This Article
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();
}