Setting Value of DropDown Box

Hi Radzen,

Here is the scenario: a patient of a clinic is assigned a routine, a routine is a specific exercise done at a specific level, where levels depend on the exercise. This is illustrated by the schema below:

So, when a user edits a routine and changes the exercise, I want to automatically reset the level to one of the levels of the new exercise.

Below is the code of my formChange event:
form0Change(event: any) {
if ( == 'ExerciseID') {
this.pbData.getLevels(ExerciseID eq ${event.value}, null, null, Sequence,Name, null, null)
.subscribe((result: any) => {
this.notificationService.notify({ severity: "info", summary: Before, detail: routine.LevelID = ${this.routine.LevelID} });

      this.levels = result.value;

      this.level = this.levels[0];

      this.routine.LevelID = this.level.LevelID;

      this.notificationService.notify({ severity: "info", summary: `After`, detail: `routine.LevelID = ${this.routine.LevelID}` });
      }, (result: any) => {

I added 2 notifications (before and after) to make sure routine.LevelID was being set to the correct value. Yet, when I save the record routine keeps its old LevelID as illustrated below:

(the Level displayed in the grid is correct, this is not a refresh issue of the grid)

This should work... What am I doing wrong?


Hi @semafox,

Radzen keeps cache of the data displayed in the grid so after editing a value the grid shows the new record without requesting the latest data from the server. In this case though the “external” change of the LevelID property isn’t picked up and displayed in the grid (I presume the right LevelID is persisted in the DB). I see two possible solutions:

  • In the main page (containing the grid) handle the Close event of the Open Dialog and request the Routines from the server side updating the property which the Data Grid is bound to.
  • Or instead of this.routine.LevelID = this.level.LevelID; try the approach from this thread. This uses the Angular Form API to update the form value. Something like this.form0.form.patchValue({ LevelID: this.level.LevelID }) should work

Hi Korchev,

The right LevelID is NOT persisted to the DB, that’s the problem…
I will try using the Angular Form API and report back.


Using the Angular Form API worked perfectly!