Show theme settings Shopping cart Download trialFree Trial
Change Theme Settings
Change Theme Settings
Show All Themes

Inline Editing (Templates)

Is New
Has Attachment
CollapseEditNewDeleteDeveloper Express - RayNew Holiday Skin12/10/2007
   Andrew FullerRe: New Holiday Skin12/10/2007
Update Cancel
 CollapseEditNewDeleteSteven BuchananRe: New Holiday Skin12/10/2007
   EditNewDeleteNancy DavolioRe: New Holiday Skin12/10/2007
 CollapseEditNewDeleteJanet LeverlingRe: New Holiday Skin12/11/2007
  CollapseEditNewDeleteMax V. Evseev (Developer Express)Re: New Holiday Skin12/12/2007
    EditNewDeleteThomas HardyRe: New Holiday Skin12/12/2007
    EditNewDeleteJanet LeverlingRe: New Holiday Skin12/12/2007
   ExpandEditNewDeleteNancy DavolioRe: New Holiday Skin12/12/2007
    EditNewDeleteLaura CallahanRe: New Holiday Skin12/15/2007
 CollapseEditNewDeleteAnne DodsworthRe: New Holiday Skin12/13/2007
   EditNewDeleteMargaret PeacockRe: New Holiday Skin12/15/2007

The TreeList allows you to provide a custom edit mode layout by creating an appropriate template for particular edited node cells or an entire Edit Form.

This demo describes how a template for the TreeList's Edit Form can be defined using the SetEditFormTemplateContent method. Within a template, custom label-editor pairs and Update/Cancel buttons are explicitly created using helpers from DevExpress Data Editors extensions (such as the Label, TextBox, ComboBox, SpinEdit, Button, etc.).

Editors used within a template are customized in the following simple manner: they are bound to corresponding model data fields (via the Bind method), are named according to these fields (via the Name property), and their ability to automatically visualize model errors when validation fails is enabled (via the ShowModelErrors property).

Editors are bound to values of the model's currently edited data object. Note that this object is passed into a template either automatically (as a template container's DataItem property - when a tree list node is just switched to the edit mode) or manually (as a ViewData data object passed from a controller - when data modifications cannot be accomplished due to an input validation fail and returning the edited data object back to the view's Edit Form without losing user changes is required). To correctly transfer values from DevExpress editors back to corresponding data model fields, the DevExpressEditorsBinder model binder is used within controller actions.

Buttons that represent the Update and Cancel links are customized so that their Text properties are defined ("Update" and "Cancel" texts) and the Click client events are handled to call the TreeList's respective client methods - UpdateEdit and CancelEdit.

See Also:
Local Copy of this Demo
To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer.
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
Open CS Solution
The source code files for this demo are installed (by default) in the following directory:
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxTreeListDemos