DxGridListEditor.SetSelectedObjects(IEnumerable) Method
Deselects all previously selected objects and selects a set of specified objects.
Namespace: DevExpress.ExpressApp.Blazor.Editors
Assembly: DevExpress.ExpressApp.Blazor.v24.1.dll
NuGet Package: DevExpress.ExpressApp.Blazor
Declaration
Parameters
Name | Type | Description |
---|---|---|
objectsToSelect | IEnumerable | A collection of objects to select. |
Remarks
The code sample below demonstrates how to create a simple action that selects objects that satisfy custom criteria within a List View:
File:
MySolution.Blazor.Server\Controllers\MySelectController.cs in solutions without the ASP.NET Core Blazor-specific module project.
MySolution.Module.Blazor\Controllers\MySelectController.cs in solutions with the ASP.NET Core Blazor-specific module project.
using DevExpress.Data.Filtering;
using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.ExpressApp.Blazor.Editors;
using DevExpress.Persistent.Base;
using MySolution.Module.BusinessObjects;
using System;
// ...
public class MySelectController : ObjectViewController<ListView, DemoTask> {
public MySelectController() {
SimpleAction selectCurrentTasksAction = new SimpleAction(this, "SelectCurrentTasksAction", PredefinedCategory.View) {
Caption = "Select Due Today Tasks",
SelectionDependencyType = SelectionDependencyType.Independent,
TargetViewNesting = Nesting.Root
};
selectCurrentTasksAction.Execute += SelectCurrentTasksAction_Execute; ;
}
private void SelectCurrentTasksAction_Execute(object sender, SimpleActionExecuteEventArgs e) {
if(View.Editor is DxGridListEditor gridListEditor) {
gridListEditor.SetSelectedObjects(
ObjectSpace.GetObjects<DemoTask>(
CriteriaOperator.FromLambda<DemoTask>(task => task.DueDate == DateTime.Today)
)
);
}
}
}
See Also