Tree List - Data Editing Inline Editing (Templates)

 FromSubjectDateIs NewHas AttachmentNew
CollapseDeveloper Express - RayNew Holiday Skin12/10/2007EditNewDelete
  Matthew RobertsRe: New Holiday Skin12/10/2007 
Update Cancel
 CollapseTrevor WesterdahlRe: New Holiday Skin12/10/2007EditNewDelete
   NC SoftwareRe: New Holiday Skin12/10/2007EditNewDelete
 CollapseAndy WallRe: New Holiday Skin12/11/2007EditNewDelete
  CollapseMax V. Evseev (Developer Express)Re: New Holiday Skin12/12/2007EditNewDelete
    Brendon MuckRe: New Holiday Skin12/12/2007EditNewDelete
    Andy WallRe: New Holiday Skin12/12/2007EditNewDelete
   ExpandNC SoftwareRe: New Holiday Skin12/12/2007EditNewDelete
    JaschaRe: New Holiday Skin12/15/2007EditNewDelete
 Collapsewolfgang hauerRe: New Holiday Skin12/13/2007EditNewDelete
   James MurrayRe: New Holiday Skin12/15/2007EditNewDelete

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:
Version: v2017 vol 1.7
Copyright © 2006-2017 Developer Express Inc
Your Next Great MVC App Starts Here

Get started today and download your 30-day trial of DevExpress MVC Extensions (includes 30 days of free technical support).

All demos ship with full source code and are included in the DevExpress MVC distribution. Refer to the Demos and Sample Applications topic to learn more.

DevExpress MVC Extensions ship as part of DevExpress Universal, DXperience and ASP.NET Subscriptions and are backed by a 60 day unconditional money-back guarantee.
To learn more and obtain pricing information, visit the Compare Features and Pricing webpage. For immediate assistance, contact us by Email at or by phone at +1 (818) 844-3383 between 7:30am and 4:30pm Pacific Time.