Error when trying to update dialog title by using the dialog with cascading values example #1803

Closed
opened 2026-01-29 17:58:48 +00:00 by claunia · 3 comments
Owner

Originally created by @jap-camasit on GitHub (Jul 9, 2025).

Describe the bug
Using the example from the dialog documentation I get the following error:
"Object reference not set to an instance of an object."

To Reproduce
Steps to reproduce the behavior:

  1. Create a page for the dialog content.
  2. Click on button to call function to change title of dialog.
  3. See error.

Alternatively link your repo with a sample project that can be run.

Expected behavior
My expectation is that the dialog title is changed.

Screenshots
Can provide code example.

Place where dialog is opened:

@page "/modal"
@inject DialogService DialogService

<RadzenButton Text="Open modal" Click=@OpenModalWithCascadingValues />

@code {
    public async Task OpenModalWithCascadingValues()
    {
        await DialogService.OpenAsync<Example.ModalExampleCascadingValues>("Modal cascading values example");
    }
}

Dialog itself:

@page "/modal/example_cascading_values";

<RadzenButton Text="Change title" ButtonStyle="ButtonStyle.Primary" Click="@SetTitle" />

@code {
    [CascadingParameter] 
    private Dialog _dialog { get; set; }
    
    void SetTitle()
    {
        _dialog.Title = "Title with a counter"; // On this line the error occurs.
    }
}

Desktop (please complete the following information):

  • Windows 11
  • Chrome (Version 138.0.7204.101 (Official Build) (64-bit))
  • Radzen Version 5.9.8

Additional context

Originally created by @jap-camasit on GitHub (Jul 9, 2025). **Describe the bug** Using the example from the dialog documentation I get the following error: "Object reference not set to an instance of an object." **To Reproduce** Steps to reproduce the behavior: 1. Create a page for the dialog content. 2. Click on button to call function to change title of dialog. 3. See error. Alternatively link your repo with a sample project that can be run. **Expected behavior** My expectation is that the dialog title is changed. **Screenshots** Can provide code example. Place where dialog is opened: ```C# @page "/modal" @inject DialogService DialogService <RadzenButton Text="Open modal" Click=@OpenModalWithCascadingValues /> @code { public async Task OpenModalWithCascadingValues() { await DialogService.OpenAsync<Example.ModalExampleCascadingValues>("Modal cascading values example"); } } ``` Dialog itself: ```C# @page "/modal/example_cascading_values"; <RadzenButton Text="Change title" ButtonStyle="ButtonStyle.Primary" Click="@SetTitle" /> @code { [CascadingParameter] private Dialog _dialog { get; set; } void SetTitle() { _dialog.Title = "Title with a counter"; // On this line the error occurs. } } ``` **Desktop (please complete the following information):** - Windows 11 - Chrome (Version 138.0.7204.101 (Official Build) (64-bit)) - Radzen Version 5.9.8 **Additional context** -
Author
Owner

@enchev commented on GitHub (Jul 10, 2025):

There is a demo here showing how to do that:
https://blazor.radzen.com/dialog?theme=material3#cascading-value

@enchev commented on GitHub (Jul 10, 2025): There is a demo here showing how to do that: https://blazor.radzen.com/dialog?theme=material3#cascading-value
Author
Owner

@jap-camasit commented on GitHub (Jul 10, 2025):

I know. I said in my description that I used the example you linked.

"Using the example from the dialog documentation"

@jap-camasit commented on GitHub (Jul 10, 2025): I know. I said in my description that I used the example you linked. "Using the example from the dialog documentation"
Author
Owner

@enchev commented on GitHub (Jul 10, 2025):

Run our demos locally to check what and where is executed. Debug also your code to check what's null.

@enchev commented on GitHub (Jul 10, 2025): Run our demos locally to check what and where is executed. Debug also your code to check what's null.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/radzen-blazor#1803