Skip to main content
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

View.Refresh() Method

In This Article

Refreshes displayed values of the View‘s controls with new values from the data source collection (not from the database itself).

Namespace: DevExpress.ExpressApp

Assembly: DevExpress.ExpressApp.v24.2.dll

NuGet Package: DevExpress.ExpressApp

#Declaration

public void Refresh()

#Remarks

Use this method to manually refresh control values in the current View when displayed objects do not raise notifications on data changes themselves (e.g., when the object type does not support INotifyPropertyChanged, or when the data source does not support IBindingList). The Refresh method refreshes data from the data source but does not reload the data source itself. To reload data from the database, use another overload of this method that takes the refreshDataSource parameter.

The following example uses a Parametrized Action to create a new Department object and refresh the Detail View. The new department becomes available in the Contact.Department Lookup List View.

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using MainDemo.Module.BusinessObjects;
// ...
public class AddDepartmentController : ObjectViewController<DetailView, Contact> {
    public AddDepartmentController() {
        ParametrizedAction addDepartmentAction = new ParametrizedAction(
            this, "AddDepartment", PredefinedCategory.Edit, typeof(string));
        addDepartmentAction.Execute += AddDepartmentAction_Execute;
    }
    private void AddDepartmentAction_Execute(object sender, ParametrizedActionExecuteEventArgs e) {
        using(IObjectSpace objectSpace = Application.CreateObjectSpace(typeof(Department))) {
            Department department = objectSpace.CreateObject<Department>();
            department.Title = e.ParameterCurrentValue as string;
            objectSpace.CommitChanges();
        }
        View.Refresh();
    }
}
See Also