Blazor global property value null

Hello Radzen team,

Blazor global property value is null when accessed from another page.

Setting property as global

Getting the global property from another page

Value is null

How can I get the value?

Hi @DBasil,

If the first page was not opened before opening the second page, the value of the global property will not be set.

Hi @enchev,

The value is set in the first page on page load. The value is retrieved in the 2nd page which is the edit page for the first one. So first page is opened first and then the edit is page is opened second.

I've just tested this and it worked for me:



Hi @enchev

I tried with a new application and it worked. If I add a global property to an existing page or a new page in an existing application and then try to use it in a subsequent page, it returns null value. I tried with 2 different applications and both times the result is same.

Setting the global property in a new page in an existing application.

Retrieving the property in another new page in the same existing application

Not sure if I understand this. In my test I’ve added new CRUD pages for Orders table from our Sample database, added new global property in Orders Page Load event and added a Label component to EditOrder page with Text bound to the global property.

@Enchev Initially I was setting the global property in the page load of an existing page (already created previously) and trying to retrieve the value using Execute c# in the page load of another existing page.

Since it was returning null, I tested it by adding a new page to an existing application and setting global property in the load event of that page. Then trying to retrieve using the Execute c# in the load event of another new page.

Both times it was returning null. I also tried using it as the binding value of text box and value was null.

When I tried it with another application (new with a single page and added a new page ) , it worked. So question is how I can get it working in an existing application.

Check if you have anything in your application ignore list in your existing application that might prevent global properties service to work properly.

I just have the _Host.cshtml file added to ignore list as I had added some code in there which I didn't want to be overwritten.

We will need your application where we can reproduce the problem in order to provide more info.

@enchev Sending email regarding this

I've checked your app and I've noticed that you've set Target for the navigation items to open new browser tabs:

This will reinitialize the entire application including the service for global variables. Maybe you are looking for this:

I had found a work around for my purpose but was wondering why global property was returning null as your documentation said as below.

Now I understand, thank you.