Problems with context definition in nested templates

Hello Radzen Dev Team!
There seems to be a problem with the context definition with many child entities.
Here is a simple example:
Parent table:
int: Id
int: Value

int Id
int ParentId (related to parent's Id)

Child 2
int Id
int ParentId (related to parent's Id)

Creating Master/Hierarchy Grid:

Let's look into Parent's template.

The application does not compile and returns an error:
dotnet: Pages / Parent.razor (54,137): error CS0103: The name 'testModelsDataChild1' does not exist in the current context [/Users/domivan/Documents/Radzen/Test/server/Test.csproj]


I understand that the context always gets the value from the previous context used.
So, the second Add button in template belongs to the previous context from grid1

How to redefine the context for the second Add button so that it belongs to the parent context?

Reproduced! I'll post more info about fix or workaround in this thread.

The workaround is to define the child grids using string template similar to this thread:

This will work for the grid, but what about the add records button?

The button(s) and the child grid(s) are part of the same template.

I understood. But this is not an option - my template is not one nested table, but an accordion with many items, nested tables, buttons, and so on.
Suggest manually write markup? And then why was the license purchased?

I don’t have any other workarounds until the bug is fixed. The fix will be released most probably before the end of this week.


Just to add some words about the license. Radzen is complex tool and in rapidly changing environment like Angular and Blazor (several major versions in less than a year) there are chances something to not work properly. The license guarantees you that your case will be verified carefully, you will receive an answer (24h response time), we will offer you workaround and we will release fix for your problem usually in the same week.

Last fix 2.45.13 only partially solved the problem.
Now the context of the child elements belongs to the parent, but only if element is in the root of the template.
If the elements are placed in other containers (cards, accordion), then the value from the last used context is still taken.

This works perfectly:

But this is not:

The add click button's event args from child2 try to pass context from child1 but not from template's root

Fixed and it will be included in the next update.

1 Like

2.46.0 Problem is not fixed, if the elements are placed in other containers (fieldset, cards, accordion etc), then the value from the last used context is still taken.

I have the following and it seems to work:

@Ivan you can send us your test application to and we will troubleshoot.

Place each group of Header, Button and Grid into different Cards or into accordion's items and error will be occurs

There is no problem with Cards:

I cannot run your app since a lot of code is missing, still I'll try to nest the child tables in Accordion items

Ok. I was able to reproduce the error and I'll post here link to latest unofficial build when ready.

1 Like

Thanks so much!
Really, nested cards works normally, but accordion isnt

And already fixed:

Build will be ready in several minutes.

1 Like

Does this fixed the problem when I expand a child and then click edit on another child the edit event seems to fail?

@joshbooker not sure if this is related - the problem in this thread is compilation error