Update UI after calling custom method

I have created a page which shows the details for a record from the database. In the Load event of the page, the record is loaded using the getXXXXById() method from EF.

In the page, there are some text boxes which are bound to the fields of the record. The page has a save and a cancel button. So everything totally standard and the same as the auto-generated pages by Radzen.

Now, I addd another button and in the Click event, I call a custom method that I have defined in code-behind:

public async void DoSomething()
{
...
}

In the method, I access some fields of the record and set new values, e.g. like this:

record.Field = "New Value";

The changes get reflected in the UI, so everything is fine.

Now, in this method, I also use some extra code like this:

if (await DialogService.Confirm("Are you sure you want to do this?") == true)

or

var dialogResult = await DialogService.OpenAsync<InputDialog>("Title Text", new Dictionary<string, object>() { { "Prompt", "Token:" }, { "Input", token } });

As soon as I use DialogService to show confirmation dialogs or input promts, the UI does not get updated any more or only randomly. So setting the fields of the record still seems to work, but the input boxes on the page do not show the changed values.

Could it be that showing the dialog boxes somehow breaks the data binding?

Is this a known problem or am I doing somehting wrong here?

Thanks for your help!

This isn't a known issue and we couldn't reproduce it at our side. Can you provide more details?

Hi,

I was able to solve the problem. I had to manually call Reload() at the end to make sure that the changes applied to the data model are also reflected by the controls in the UI. I seems that showing dialog or notification boxes while changing the data model (still in dirty state, so not persisted) breaks in some situations the automatic data binding (or at least the updating since the binding itself is still ok).

Best regards,

Joe

I have also experienced the same problem and I just called below method just after the Dialogue result success operation
this.StateHasChanged();

Hope this will help others