Skip to main content
A newer version of this page is available. .

Make a List View Editable

  • 2 minutes to read

In this lesson, you will learn how to make a List View editable. For this purpose, the DemoTask List View will be used.

Note

Before proceeding, take a moment to review the following lessons.

  • Invoke the Model Editor for the MySolution.Module project. Navigate to the Views | MySolution.Module.BusinessObjects | DemoTask_ListView node. It defines the List View that is used for DemoTask objects with the properties to the right. In the AllowEdit property’s dropdown list, select “True”. When this property is set to “True”, the List View is editable.

    When List Views are displayed in edit mode, you can apply the NewItemRow functionality of the XtraGrid that displays ListViews in XAF applications. This functionality allows end-users to create new objects directly in a List View without a Detail View. To add this functionality, set the NewItemRowPosition property to Top or Bottom.

    Tutorial_UIC_Lesson18_1

    Tip

    In ASP.NET applications, there are several modes for editing. To set the required mode, use the IModelListViewWeb.InlineEditMode property in the Model Editor invoked for the MySolution.Module.Web project. Various edit modes are illustrated in the List View Edit Modes topic (ASP.NET-Specific Functionality section).

  • Run the WinForms or ASP.NET application and edit one of the DemoTask objects within the List View.

    Tutorial_UIC_Lesson18_2

    To edit one of the DemoTask objects in an ASP.NET application, click Edit(InlineEdit_EditButton) or click New(InlineEdit_NewButton) to create a new Task.

    Tutorial_UIC_Lesson18_2_Web

    In a WinForms application, to save the changes made to an object, click the Save (btn_Save) or SaveAndClose (btn_SaveClose) button on the toolbar. To cancel the changes, click the Cancel (btn_Cancel) button.

    In the ASP.NET application, to save changes, click Update (btn_Save). To cancel the changes, click Cancel (btn_Cancel).

Note

You can set the edit mode in code. To do this, apply the DefaultListViewOptionsAttribute attribute to the DemoTask class.

To see the changes made in this lesson, invoke the Model Editor for the Main Demo’s MainDemo.Module, MainDemo.Module.Win and MainDemo.Module.Web projects. The MainDemo application is installed in %PUBLIC%\Documents\DevExpress Demos 18.2\Components\eXpressApp Framework\MainDemo by default. The ASP.NET version of this demo is available online at https://demos.devexpress.com/XAF/MainDemo.

 

Next Lesson: Add a Preview to a List View

See Also